Part Number Hot Search : 
M3DCC10 MBR10100 TDA4800 AD7824BQ 101J1 HIP6004E C100LV QED423
Product Description
Full Text Search
 

To Download BS83B16A-4 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  8-bit touch key flash mcu bs83b08a-3/bs83b08a-4 bs83b12a-3/bs83b12a-4 bs83b16a-3/BS83B16A-4 revision: v1.00 date: ? a ? 0 ?? ? 01 ? ? a ? 0 ?? ? 01 ?
rev. 1.00 ? ? a ? 0 ?? ? 01 ? rev. 1.00 ? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu table of contents eates cpu features ......................................................................................................................... 6 peripheral features ................................................................................................................. 6 general description ........................................................................................ 7 selection table ................................................................................................. 7 block diagram .................................................................................................. 8 pin assignment ........... ..................................................................................... 9 pin descriptions ............................................................................................ 10 absolute ?aximum ratings .......................................................................... 1? d.c. characteristics ....................................................................................... 1? a.c. characteristics ....................................................................................... 15 power-on reset characteristics ........... ....................................................... 15 s?stem architecture ...................................................................................... 16 clocking and pipelining ......................................................................................................... 16 program counter ................................................................................................................... 17 stack ..................................................................................................................................... 18 arithmetic and logic unit C alu ........................................................................................... 18 flash program ?emor? ................................................................................. 19 structure ................................................................................................................................ 19 special vectors ..................................................................................................................... 19 look-up table ............. ........................................................................................................... ? 0 table program example ........................................................................................................ ? 1 in circuit programming ......................................................................................................... ?? ra? data ?emor? ......................................................................................... ?? structure ................................................................................................................................ ?? special function register description ........................................................ ?? indirect addressing registers C iar0 ? iar1 ......................................................................... ?? ? emor ? pointers C ? p0 ? ? p1 .............................................................................................. ? 6 bank pointer C bp ................................................................................................................. ? 7 accumulator C acc ............................................................................................................... ? 7 program counter low register C pcl .................................................................................. ? 7 look-up table registers C tblp ? tbhp ? tblh ..................................................................... ? 7 status register C status .................................................................................................... ? 8
rev. 1.00 ? ?a? 0?? ?01? rev. 1.00 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu eeprom data memory ........... ....................................................................... 30 eepro ? data ? emor ? structure ........................................................................................ ? 0 eepro ? registers ............ .................................................................................................. ? 0 reading data from the eepro ? ........................................................................................ ?? writing data to the eepro ? ................................................................................................ ?? write protection ..................................................................................................................... ?? eepro ? interrupt ............. ................................................................................................... ?? programming considerations ............. ................................................................................... ?? oscillator ........................................................................................................ 34 oscillator overview ............. .................................................................................................. ? 4 system clock confgurations ................................................................................................ ? 4 internal rc oscillator C hirc ............. .................................................................................. ? 5 internal ?? khz oscillator C lirc ........................................................................................... ? 5 operating modes and system clocks ......................................................... 35 s ? stem clocks ...................................................................................................................... ? 5 s ? stem operation ? odes ...................................................................................................... ? 6 control register .................................................................................................................... ? 8 operating ? ode switching ................................................................................................... 40 nor ? al ? ode to slow ? ode switching ........................................................................... 41 slow ? ode to nor ? al ? ode switching .......................................................................... 41 entering the sleep ? ode .................................................................................................... 41 entering the idle0 ? ode ...................................................................................................... 41 entering the idle1 ? ode ...................................................................................................... 4 ? standb ? current considerations ........................................................................................... 4 ? wake-up ................................................................................................................................ 44 programming considerations ............. ................................................................................... 44 watchdog timer ........... .................................................................................. 45 watchdog timer clock source .............................................................................................. 45 watchdog timer control register ............. ............................................................................ 45 watchdog timer operation ................................................................................................... 46 reset and initialisation .................................................................................. 47 reset functions ............. ....................................................................................................... 47 reset initial conditions ......................................................................................................... 50 input/output ports ......................................................................................... 56 i/o register list .................................................................................................................... 56 pull-high resistors ................................................................................................................ 57 port a wake-up ............. ........................................................................................................ 58 i/o port control registers ..................................................................................................... 59 i/o pin structures .................................................................................................................. 60 programming considerations ............. ................................................................................... 60
rev. 1.00 4 ? a ? 0 ?? ? 01 ? rev. 1.00 5 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu timer/event counter ..................................................................................... 61 confguring the timer/event counter input clock source .................................................... 61 timer register C t ? r ........................................................................................................... 61 timer control register C t ? rc ............................................................................................ 6 ? timer operation ............. ....................................................................................................... 6 ? prescaler ............................................................................................................................... 6 ? programming considerations ............. ................................................................................... 6 ? touch key function ...................................................................................... 63 touch ke ? structure .............................................................................................................. 6 ? touch key register defnition ............................................................................................... 64 touch ke ? operation ............................................................................................................. 69 touch ke ? interrupt ............................................................................................................... 7 ? programming considerations ............. ................................................................................... 7 ? serial interface module C sim ...................................................................... 72 spi interface ........................................................................................................................ 7 ? spi interface operation ........................................................................................................ 7 ? spi registers ............. ........................................................................................................... 74 spi communication ............................................................................................................. 77 i ? c interface ............ ............................................................................................................. 79 i ? c interface operation ......................................................................................................... 79 i ? c registers ......................................................................................................................... 80 i ? c bus communication ....................................................................................................... 85 i ? c bus start signal .............................................................................................................. 86 slave address ...................................................................................................................... 86 i ? c bus read/write signal ................................................................................................... 86 i ? c bus slave address acknowledge signal ........................................................................ 86 i ? c bus data and acknowledge signal ............ .................................................................... 87 i ? c time-out control .............................................................................................................. 89 interrupts ........................................................................................................ 90 interrupt registers ................................................................................................................. 90 interrupt operation ................................................................................................................ 9 ? external interrupt ............. ...................................................................................................... 94 time base interrupt ............................................................................................................... 94 timer/event counter interrupt ............................................................................................... 95 eepro ? interrupt ............. ................................................................................................... 95 touch ke ? interrupt ............................................................................................................... 96 si ? interrupt ......................................................................................................................... 96 interrupt wake-up function ................................................................................................... 96 programming considerations ............. ................................................................................... 97
rev. 1.00 4 ?a? 0?? ?01? rev. 1.00 5 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu application circuits ........... ............................................................................ 98 instruction set ................................................................................................ 99 instruction ............. ................................................................................................................. 99 instruction timing .................................................................................................................. 99 ? oving and transferring data ............................................................................................... 99 arithmetic operations ............................................................................................................ 99 logical and rotate operations ............. ............................................................................... 100 branches and control transfer ........................................................................................... 100 bit operations ..................................................................................................................... 100 table read operations ....................................................................................................... 100 other operations ............. .................................................................................................... 100 instruction set summary .......... .................................................................. 101 table conventions ............................................................................................................... 101 instruction defnition ................................................................................... 103 package information .................................................................................... 112 16-pin nsop (150mil) outline dimensions .......................................................................... 11 ? 16-pin ssop(150mil) outline dimensions ........................................................................... 114 ? 0-pin sop ( ? 00mil) outline dimensions ............................................................................ 115 ? 0 -pin ssop (150mil) outline dimensions .......................................................................... 116 ? 4-pin sop ( ? 00mil) outline dimensions ............................................................................ 117 ? 4-pin ssop (150mil) outline dimensions .......................................................................... 118
rev. 1.00 6 ? a ? 0 ?? ? 01 ? rev. 1.00 7 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu features cpu features ? operating v oltage: for bs83b08a-3/bs83b12a-3/bs83b16a-3 C f sys =8m hz: 2. 7v~5.5v C f sys =12m hz: 2.7v~5.5v C f sys =16m hz: 4.5v~5.5v for bs83b08a-4/bs83b12a-4/BS83B16A-4 C f sys =8mhz: 2.2v~5.5v C f sys =12mhz: 2.7v~5.5v C f sys =16mhz: 4.5v~5.5v ? up to 0.2 5 s instruction cycle with 16 mhz system clock at v dd =5v ? fully integrated 8/12/16 touch key functions -- require no external components ? power down and wake-up functions to reduce power consumption ? fully integrated low and high speed internal oscillators ? low speed -- 32khz ? high speed -- 8mhz, 12mhz, 16mhz ? multi-mode operation: normal, slow, idle and sleep ? all instructions executed in one or two instruction cycles ? table read instructions ? 63 powerful instructions ? up to 4 -level subroutine nesting ? bit manipulation instruction peripheral features ? flash program memory: 2k16 ? ram data memory: 1608~2888 ? eeprom memory: 648 ? watchdog t imer function ? up to 22 bidirectional i/o lines ? external interrupt line shared with i/o pin ? single 8-bit t imer/event counter ? single t ime-base function for generation of fxed time interrupt signals ? i 2 c and spi interfaces ? low voltage reset function ? 8/12/16 touch key functions ? high current led driver
rev. 1.00 6 ?a? 0?? ?01? rev. 1.00 7 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu general description these devices are a series of flash memory type 8-bit high performance risc architecture microcontrollers with fully integrated touch key functions. w ith all touch key functions provided internally and with the convenience of flash memory multi-programming features, this device range has a ll the features to offer designers a reliable and easy m eans of i mplementing t ouch keyes within their products applications. the t ouch ke y func tions a re ful ly i ntegrated c ompletely e liminating t he ne ed for e xternal components. in addition to the fash program memory , other memory includes an area of ram data memory as well as an area of eep rom memory for storage of non-volatile data such as serial numbers, c alibration da ta e tc. prot ective fe atures suc h a s a n i nternal w atchdog t imer a nd l ow voltage reset functions coupled with excellent noise immunity and esd protection ensure that reliable operation is maintained in hostile electrical environments. all d evices i nclude f ully i ntegrated l ow a nd h igh sp eed o scillators wh ich r equire n o e xternal components for their implementation. t he ability to operate and switch dynamically between a range of operating modes using dif ferent clock sources gives users the ability to optimise microcontroller operation and minimise power consumption. easy communication with the outside world is provided using the internal i 2 c and spi inter faces, while the inclusion of fexible i/o programming features, timer/event counters and many other features further enhance device functionality and fexibility. these touch key devices will find excellent use in a huge range of modern t ouch key product applications such as instrumentatio n, household appliances, electronic ally controlled tools to name but a few. selection table most features are common to all devices, the main distinguishing feature is the number of i/os and touch keys. the following table summarises the main features of each device. part no. internal clock v dd system clock program memory data memory data eeprom i/o high current led output 8-bit timer time base touch key spi/ i 2 c lvr stack package bs8 ? b08a- ? 8 ? hz 1 ?? hz 16 ? hz ? .7v~ 5.5v 8 ? hz~ 16 ? hz ? k16 1608 648 14 1 1 8 1 ? .55v 4 16nsop/ ssop bs8 ? b08a-4 8 ? hz 1 ?? hz 16 ? hz ? . ? v~ 5.5v 8 ? hz~ 16 ? hz ? k16 1608 648 14 1 1 8 1 ? .10v 4 16nsop/ ssop bs8 ? b1 ? a- ? 8 ? hz 1 ?? hz 16 ? hz ? .7v~ 5.5v 8 ? hz~ 16 ? hz ? k16 ? 888 648 18 18 1 1 1 ? 1 ? .55v 4 ? 0sop/ ssop bs8 ? b1 ? a-4 8 ? hz 1 ?? hz 16 ? hz ? . ? v~ 5.5v 8 ? hz~ 16 ? hz ? k16 ? 888 648 18 18 1 1 1 ? 1 ? .10v 4 ? 0sop/ ssop bs8 ? b16a- ? 8 ? hz 1 ?? hz 16 ? hz ? .7v~ 5.5v 8 ? hz~ 16 ? hz ? k16 ? 888 648 ?? ?? 1 1 16 1 ? .55v 4 ? 4sop/ ssop bs8 ? b16a-4 8 ? hz 1 ?? hz 16 ? hz ? . ? v~ 5.5v 8 ? hz~ 16 ? hz ? k16 ? 888 648 ?? ?? 1 1 16 1 ? .10v 4 ? 4sop/ ssop
rev. 1.00 8 ? a ? 0 ?? ? 01 ? rev. 1.00 9 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu block diagram              
        ?  ?  ?      ?      ?       ?         -   
        
?  -   
 ?  ?    ? ? ?        ?     ?
 ?  ?
rev. 1.00 8 may 02, 2013 rev. 1.00 9 may 02, 2013 bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu pin assignment bs83b08a-3/bs83b08a-4 16 nsop-a/ssop-a bs83b12a-3/bs83b12a-4 20 sop-a/ssop-a bs83b16a-3/BS83B16A-4 24 sop-a/ssop-a
rev. 1.00 10 ? a ? 0 ?? ? 01 ? rev. 1.00 11 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu pin descriptions the function of each pin is listed in the following table s , however the details behind how each pin is confgured is contained in other sections of the datasheet. bs83b08a-3/bs83b08a-4 pin name function opt i/t o/t description pa0/ sdi/sda pa0 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sdi st spi data input sda st n ? os i ? c data pa1/ sdo pa1 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sdo si ? c 0 c ? os spi data output pa ? / sck/scl pa ? pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sck si ? c0 st c ? os spi serial clock scl si ? c0 st n ? os i ? c clock pa ? /scs pa ? pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up scs si ? c0 st c ? os spi slave select pa4/ int pa4 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up int integ st external interrupt pa7 pa7 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up pb0/key1~ pb ? /key4 pb0 ~pb ? pbpu st c ? os general purpose i/o. register enabled pull-up key1~key4 tk ? 0c1 nsi touch ke ? inputs pb4/key5~ pb7/key8 pb4~pb7 pbpu st c ? os general purpose i/o. register enabled pull-up key5~ key8 tk ? 1c1 nsi touch ke ? inputs vdd vdd pwr power suppl ? * avdd avdd pwr touch ke ? circuit pwr and it should be double bonded to vdd* vss vss pwr ground ** avss avss pwr touch ke ? circuit pwr and it should be double bonded to vss** note: i/t: input type o/t: output type op: optional by register selection pwr: power st: chmitt t rigger input cmos: cmos output nmos: nmos output nsi: non-standard input *: vdd is the device power supply while a vdd is the touch key circuit power supply . the a vdd pin is bonded together internally with vdd. **: vss is the device ground pin while a vss is the touch key circuit ground pin. the a vss pin is bonded together internally with vss.
rev. 1.00 10 ?a? 0?? ?01? rev. 1.00 11 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bs83b12a-3/bs83b12a-4 pin name function opt i/t o/t description pa0/ sdi/sda pa0 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sdi st spi data input sda st n ? os i ? c data pa1/ sdo pa1 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sdo si ? c 0 c ? os spi data output pa ? / sck/scl pa ? pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sck si ? c0 st c ? os spi serial clock scl si ? c0 st n ? os i ? c clock pa ? /scs pa ? pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up scs si ? c0 st c ? os spi slave select pa4/ int pa4 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up int integ st external interrupt pa7 pa7 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up pb0/key1~ pb ? /key4 pb0 ~pb ? pbpu st c ? os general purpose i/o. register enabled pull-up key1~key4 tk ? 0c1 nsi touch ke ? inputs pb4/key5~ pb7/key8 pb4~pb7 pbpu st c ? os general purpose i/o. register enabled pull-up key5~key8 tk ? 1c1 nsi touch ke ? inputs pc0/key9~ pc ? / key1 ? pc0 ~pc ? pcpu st c ? os general purpose i/o. register enabled pull-up key9~ key1 ? tk ?? c1 nsi touch ke ? inputs vdd vdd pwr power suppl ? * avdd avdd pwr touch ke ? circuit pwr and it should be double bonded to vdd* vss vss pwr ground ** avss avss pwr touch ke ? circuit pwr and it should be double bonded to vss** note: i/t: input type o/t: output type op: optional by register selection pwr: power st: chmitt t rigger input cmos: cmos output nmos: nmos output nsi: non-standard input *: vdd is the device power supply while a vdd is the touch key circuit power supply . the a vdd pin is bonded together internally with vdd. **: vss is the device ground pin while a vss is the touch key circuit ground pin. the a vss pin is bonded together internally with vss.
rev. 1.00 1 ? ? a ? 0 ?? ? 01 ? rev. 1.00 1? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bs83b16a-3/BS83B16A-4 pin name function opt i/t o/t description pa0/ sdi/sda pa0 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sdi st spi data input sda st n ? os i ? c data pa1/ sdo pa1 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sdo si ? c 0 c ? os spi data output pa ? / sck/scl pa ? pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up sck si ? c0 st c ? os spi serial clock scl si ? c0 st n ? os i ? c clock pa ? /scs pa ? pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up scs si ? c0 st c ? os spi slave select pa4/ int pa4 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up int integ st external interrupt pa7 pa7 pa wu pa pu st c ? os general purpose i/o. register enabled pull-up and wake-up pb0/key1~ pb ? /key4 pb0 ~pb ? pbpu st c ? os general purpose i/o. register enabled pull-up key1~key4 tk ? 0c1 nsi touch ke ? inputs pb4/key5~ pb7/key8 pb4~pb7 pbpu st c ? os general purpose i/o. register enabled pull-up key5~key8 tk ? 1c1 nsi touch ke ? inputs pc0/key9~ pc ? / key1 ? pc0 ~pc ? pcpu st c ? os general purpose i/o. register enabled pull-up key9~ key1 ? tk ?? c1 nsi touch ke ? inputs p c4/key1 ? ~ pc7/key16 pc4~pc7 pcpu st c ? os general purpose i/o. register enabled pull-up key1 ? ~ key16 tk ?? c1 nsi touch ke ? inputs vdd vdd pwr power suppl ? * avdd avdd pwr touch ke ? circuit pwr and it should be double bonded to vdd* vss vss pwr ground ** avss avss pwr touch ke ? circuit pwr and it should be double bonded to vss** note: i/t: input type o/t: output type op: optional by register selection pwr: power st: chmitt t rigger input cmos: cmos output nmos: nmos output nsi: non-standard input *: vdd is the device power supply while a vdd is the touch key circuit power supply . the a vdd pin is bonded together internally with vdd. **: vss is the device ground pin while a vss is the touch key circuit ground pin. the a vss pin is bonded together internally with vss.
rev. 1.00 1? ?a? 0?? ?01? rev. 1.00 1 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu absolute maximum ratings supply v oltage .............. .................................................................................. v ss ?0.3v to v ss +6.0v input v oltage .............. .................................................................................... v ss ? 0.3v to v dd +0.3v storage t emperature ............... .................................................................................... -50 c to 125c operating t emperature .............. ................................................................................... -40 c to 85 c i oh t otal .............. ...................................................................................................................... -80ma i ol t otal .............. ....................................................................................................................... 80ma total power dissipation .............. .......................................................................................... 500mw note: t hese a re st ress ra tings onl y. st resses e xceeding t he ra nge spe cified und er "absol ute ma ximum ratings" m ay c ause subst antial da mage t o t he de vice. funct ional ope ration of t his de vice a t ot her conditions beyond those listed in the specifcation is not implied and prolonged exposure to extreme conditions may affect device reliability. d.c. characteristics ta= ? 5c symbol parameter test conditions min. typ. max. unit v dd conditions v dd operating voltage (hirc) (bs8 ? b08a- ? /bs8 ? b1 ? a- ? / bs8 ? b16a- ? ) f sys =8 ? hz ? .7 5.5 v f sys = 1 ? ? hz ? .7 5.5 v f sys =16 ? hz 4.5 5.5 v v dd operating voltage (hirc) (bs8 ? b08a-4/bs8 ? b1 ? a-4/ bs8 ? b16a-4) f sys =8 ? hz ? . ? 5.5 v f sys = 1 ? ? hz ? .7 5.5 v f sys =16 ? hz 4.5 5.5 v i dd1 operating current (hirc ? f sys =f h ? f s =f sub =f lirc ) ? v no load ? f h =8 ? hz ? wdt enable 1. ? 1.8 ma 5v ? . ? ? . ? ma ? v no load ? f h = 1 ? ? hz ? wdt enable 1.6 ? .4 ma 5v ? . ? 5.0 ma ? v no load ? f h =16 ? hz ? wdt enable ? .0 ? .0 ma 5v 4.0 6.0 ma i dd ? operating current (hirc ? f sys =f l ? f s =f sub =f lirc ) ? v no load ? f h = 1 ? ? hz ? f l =f h / ?? wdt enable 1. ? ? .0 ma 5v ? . ? ? . ? ma ? v no load ? f h = 1 ? ? hz ? f l =f h /4 ? wdt enable 1.0 1.5 ma 5v 1.8 ? .7 ma 5v no load ? f h = 1 ? ? hz ? f l =f h /8 ? wdt enable 0.9 1.4 ma ? v 1.6 ? .4 ma ? v no load ? f h = 1 ? ? hz ? f l =f h /16 ? wdt enable 0.8 1. ? ma 5v 1.5 ? . ? ma ? v no load ? f h = 1 ? ? hz ? f l =f h / ??? wdt enable 0.8 1. ? ma 5v 1.5 ? . ? ma 5v no load ? f h = 1 ? ? hz ? f l =f h /64 ? wdt enable 0.8 1. ? ma ? v 1.5 ? . ? ma i dd ? operating current (lirc ? f sys =f l =f lirc ? f s =f sub =f lirc ) ? v no load ? wdt enable ? lvr enable 50 100 5v 70 150 i stb1 idle ? ode standb ? current (hirc ? f sys =f h ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = 1 ? ? hz 0.9 1.4 ma 5v 1.4 ? .1 ma
rev. 1.00 14 ? a ? 0 ?? ? 01 ? rev. 1.00 15 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu symbol parameter test conditions min. typ. max. unit v dd conditions i stb ? idle ? ode standb ? current (hirc ? f sys =off ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = 1 ? ? hz ? lvr enable 40 80 a 5v 50 100 a i stb ? idle ? ode standb ? current (hirc ? f sys =f l ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = 1 ? ? hz /64 0.7 1.1 ma 5v 1.4 ? .1 ma i stb4 idle ? ode standb ? current (hirc ? f sys =off ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = 1 ? ? hz /64 ? lvr enable 40 80 a 5v 50 100 a i stb5 idle ? ode standb ? current (lirc ? f sys =f l =f lirc ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = ?? k hz 1.9 4.0 a 5v ? . ? 7.0 a i stb6 idle ? ode standb ? current (lirc ? f sys =off ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = ?? k hz ? lvr enable 40 80 a 5v 50 100 a i stb7 sleep ? ode standb ? current (hirc ? f sys =off ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = 1 ?? hz ? lvr enable 40 80 a 5v 50 100 a i stb8 sleep ? ode standb ? current (lirc ? f sys =off ? f s =f sub =f lirc ) ? v no load ? s ? stem halt ? wdt enable ? f sys = ?? k hz 1. ? ? .0 a 5v ? .4 5.0 a v il input low voltage for i/o ports or input pins 5v 0 1.5 v 0 0. ? v dd v v ih input high voltage for i/o ports or input pins 5v ? .5 5.0 v 0.8v dd v dd v v lvr low voltage reset voltage (bs8 ? b08a- ? /bs8 ? b1 ? a- ? / bs8 ? b16a- ? ) lvr enable ? ? .55v -5% ? .55 +5% v v lvr low voltage reset voltage (bs8 ? b08a-4/bs8 ? b1 ? a-4/ bs8 ? b16a-4) lvr enable ? ? .10v -5% ? .10 +5% v i lvr low voltage reset current lvr enable 6 ? 90 a i ol sink current for i/o port (bs8 ? b08a- ? /bs8 ? b08a-4) ? v v ol =0.1v dd 4 8 ma 5v 10 ? 0 ma i ol sink current for i/o port (bs8 ? b1 ? a- ? /bs8 ? b1 ? a-4 ? bs8 ? b16a- ? /bs8 ? b16a-4) ? v v ol =0.1v dd 8 16 ma 5v 16 ?? ma i oh source current for i/o port (bs8 ? b08a- ? /bs8 ? b08a-4) ? v v oh =0.9v dd - ? -4 ma 5v -5 -10 ma i oh source current for i/o port (bs8 ? b1 ? a- ? /bs8 ? b1 ? a-4 ? bs8 ? b16a- ? /bs8 ? b16a-4) ? v v oh =0.9v dd - ? .75 -7.5 ma 5v -7.5 -15 ma r ph pull-high resistance for i/o ports ? v ? 0 60 100 k 5v 10 ? 0 50 k
rev. 1.00 14 ?a? 0?? ?01? rev. 1.00 15 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu a.c. characteristics ta= ? 5c symbol parameter test conditions min. typ. max. unit v dd conditions f sys s ? stem clock (hirc) ? v/5v ta= ? 5c - ? % 8 + ? % ? hz - ? % 1 ? + ? % ? hz - ? % 16 + ? % ? hz f ti ? er timer input pin frequenc ? ? . 7v~5.5v 8 ? hz ? .7 v~5.5v 1 ? ? hz 4.5v~5.5v 16 ? hz f lirc s ? stem clock ( ?? khz) 5v ta = ? 5c - ? % ?? + ? % khz t int interrupt pulse width 1 s t lvr low voltage width to reset 60 1 ? 0 ? 40 s t eerd eepro ? read time 1 ? 4 t sys t eewr eepro ? write time 1 ? 4 ms t sst s ? stem start-up timer period (wake-up from halt) f sys =hirc 15~16 ? 0 t sys f sys =lirc 1~ ? note: w 66 i 66 7 r pdlwdl wkh dffxdf ri wkh lwhdo ,5 rvfloodwr ihtxhf d ghfrxsol fdsdflwr vkrxog eh frhfwhg ehwzhh dg 66 dg orfdwhg dv forvh wr wkh ghylfh dv srvvleoh 0 fd rw eh xvhg zkh wkh vxsso yrowdh lv ehorz power-on reset characteristics symbol parameter test conditions min. typ. max. unit v dd conditions v por v dd start voltage to eensure power-on reset 100 mv rr vdd v dd raising rate to ensure power-on reset 0.0 ? 5 v/ms t por ? inimum time for v dd sta ? s at v por to ensure power-on reset 1 ms
rev. 1.00 16 ? a ? 0 ?? ? 01 ? rev. 1.00 17 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu system architecture a key factor in the high-performan ce features of the holtek range of microcontrollers is attributed to their internal system architecture. the range of devices take advantag e of the usual features found within risc microcontrollers providing increased speed of operation and periodic performance. the pipelining scheme is implemented in such a way that instruction fetching and instruction execution are overlapped, hence instructions are effectively executed in one cycle, with the exception of branch or c all i nstructions. an 8-bi t wi de al u i s use d i n pra ctically a ll i nstruction se t ope rations, whi ch carries out arithme tic operations, logic operations, rotation, increment, decrement, branch decisions, etc. the internal data path is simplified by moving data through the accumulator and the alu. certain internal regis ters are implemented in the d ata m emory and can be directly or indirectly addressed. the simpl e addressing methods of these registers along with additional architectural features ensure that a minimum of external components is required to provide a functional i/o control system with maximum relia bility and fexibility . this makes th ese device s suitable for low- cost, high-volume production for controller applications. clocking and pipelining the mai n system clock, deri ved from eit her a high or low speed oscilla tor is subdivide d into four internally generated non-overlapping clocks, t1~t4. the program counter is incremented at the beginning of the t1 clock during which time a new instruction is fetched. the remaining t2~t4 clocks carry out the decoding and execution functions. in this way , one t1~t4 clock cycle forms one instruction cycle. although the fetching and execution of instructio ns takes place in consecutive instruction c ycles, t he pi pelining st ructure of t he m icrocontroller e nsures t hat i nstructions a re effectively executed in one instruction cycle. the exception to this are instructions where the contents of the program counter are changed, such as subroutine calls or jumps, in which case the instruction will take one more instruction cycle to execute. system clock and pipelining
rev. 1.00 16 ?a? 0?? ?01? rev. 1.00 17 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu for instructions involving branches, such as jump or call instructions, two machine cycles are required to complete instruction execution. an extra cycle is required as the program takes one cycle t o frst obt ain t he a ctual j ump or c all a ddress a nd t hen a nother c ycle t o a ctually e xecute t he branch. the requirement for this extra cycle should be taken into account by programmers in timing sensitive applications. instruction fetching program counter during pro gram e xecution, t he progr am co unter i s use d t o ke ep t rack of t he a ddress of t he next instruction to be executed. it is automatically incremented by one each time an instruction is e xecuted e xcept f or i nstructions, su ch a s jmp o r call t hat d emand a j ump t o a non-consecutive pr ogram me mory a ddress. on ly t he l ower 8 b its, k nown a s t he pr ogram c ounter low register, are directly addressable by the application program. when executi ng instructions re quiring jumps to non-consecutive addresses suc h as a jump instruction, a subrout ine c all, i nterrupt or re set, e tc., t he m icrocontroller m anages progra m c ontrol by loading the required address into the program counter . for conditional skip instructions, once the condition has been met, the next instruction, which has already been fetched during the present instruction execut ion, is discarded and a dummy cycle takes its place while the correct instruction is obtained. device program counter program counterhigh byte pcl register bs8 ? b08a- ? /bs8 ? b08a-4 pc10~pc8 pcl7~pcl0 bs8 ? b1 ? a- ? /bs8 ? b1 ? a-4 pc10~pc8 bs8 ? b16a- ? /bs8 ? b16a-4 pc10~pc8 the lower byte of the program counter , known as the program counter low register or pcl, is available for program control and is a readable and writeable register . by transferring data directly into t his r egister, a sh ort p rogram j ump c an b e e xecuted d irectly, h owever, a s o nly t his l ow b yte is available for manipulation, the jumps are limited to the present page of memory , that is 256 locations. when such program jumps are executed it should also be noted that a dummy cycle will be inserted. manipulating the pcl register may cause program branching, so an extra cycle is needed to pre-fetch.
rev. 1.00 18 ? a ? 0 ?? ? 01 ? rev. 1.00 19 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu stack this is a special part of the memory which is used to save the contents of the program counter only. the stack is neither part of the data nor part of the program space, and is neither readable nor writeable. the activated level is indexed by the stack pointer , and is neither readable nor writeable. at a subroutine call or interrupt acknowledge signal, the contents of the program counter are pushed onto the stack. at the end of a subroutine or an interrupt routine, signaled by a return instruction, ret or reti, the program counter is restored to its previous value from the stack. after a device reset, the stack pointer will point to the top of the stack. if the stack is full and an enabled interrupt takes place, the interrupt request fag will be recorded but the acknowledge signal will be inhibited. when the stack pointer is decremented, by ret or reti, the interrupt will be serviced. this feature prevents stack overfow allowing the programmer to use the structure more easily . however , when the stack is full, a call subroutine instruction can still be exec uted whic h wi ll result in a st ack overfow . prec autions should be ta ken to avoid such cases which might cause unpredictable program branching. if the stack is overfow , the frst program counter save in the stack will be lost. arithmetic and logic unit C alu the arith metic-logic unit or alu is a critical area of the microcontrol ler that carries out arithmetic and logic operations of the instructi on set. connected to the main micro controller data bus, the alu receives related ins truction codes and performs the required arithmetic or logical operations after which the result will be placed in the specifed register . as these alu calculation or operations may result in carry , borrow or other status changes, the status register will be correspondingly updated to refect these changes. the alu supports the following functions: ? arithmetic operations: add, addm, adc, adcm, sub, subm, sbc, sbcm, daa ? logic operations: and, or, xor, andm, orm, xorm, cpl, cpla ? rotation rra, rr, rrca, rrc, rla, rl, rlca, rlc ? increment and decrement inca, inc, deca, dec ? branch decision, jmp, sz, sza, snz, siz, sdz, siza, sdza, call, ret, reti
rev. 1.00 18 ?a? 0?? ?01? rev. 1.00 19 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu flash program memory the program memory is the location where the user code or program is stored. for this device series the program memory is flash type, which means it can be programmed and re-programmed a l arge num ber of t imes, a llowing t he use r t he c onvenience of c ode m odification on t he sa me device. by using the appropriate programming tools, these flash device s of fer users the fexibility to conveniently debug and develop their applications while also of fering a means of feld programming and updating. structure the progra m me mory ha s a c apacity of 2k16 bi ts. t he progra m me mory i s a ddressed by t he program counter and also contains data, table information and interrupt entries. t able data, which can be setup in any location within the program memory , is addressed by a separate table pointer register. special vectors within the program memory , certai n locations are reserved for the reset and interrupts. the location 000h is reserved for use by the device reset for program initialisation. after a device reset is initiated, the program will jump to this location and begin execution. program memory structure
rev. 1.00 ? 0 ? a ? 0 ?? ? 01 ? rev. 1.00 ?1 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu look-up table any location within the program memory can be defned as a look-up table where programmers can store fxed data. t o use the look-up table, the table pointer must frst be setup by placing the address of the look up data to be retrieved in the table pointer register , tblp and tbhp . these registers defne the total address of the look-up table. after setting up the table pointer , the table data can be retrieved from the program memory using the t abrd c [m] or t abrdl [m] instructions, respectively . when the instruction is executed, the low er order table byte from the program memory will be transferred to the user defned data memory regis ter [m] as specifed in the instruction. the higher order table data byte from the program memory will be transferred to the tblh special register . any unused bits in this transferred higher order byte will be read as 0. the accompanying diagram illustrates the addressing data fow of the look-up table. instruction table location bits b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 tabrdc [m] @10 @9 @8 @7 @6 @5 @4 @ ? @ ? @1 @0 tabrdl [m] 1 1 1 @7 @6 @5 @4 @ ? @ ? @1 @0 table location note: b 10b0 : table location bits @7~@0: t able pointer (tblp) bits 108 : t able pointer (tb p) bits
rev. 1.00 ?0 ?a? 0?? ?01? rev. 1.00 ? 1 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu table program example the following example shows how the table pointer and table data is defned and retrieved from the microcontroller. this example uses raw table data located in the program memory which is stored there using the org statement. the value at this org statement is 700h which refers to the start address of the last page within the 2k words program memory of the device. the table pointer is setup here to have an initial value of 06h. this will ensure that the frst data read from the data table will be at the program memory address 706h or 6 locations after the start of the last page. note that the value for the table pointer is referenced to the frst address of the present page if the tabrd c [m] instruction is being used. the high byte of the table data which in this case is equal to zero will be transferred to the tblh register automatically when the t abrd c [m] instruction is executed. because the tblh register is a read-only register and cannot be res tored, care should be taken to ensure its protection if both the main routine and interrupt s ervice routine us e table read instructions. if using the table read instructions, the interrupt service routines may change the value of the tblh and subsequently cause errors if used again by the main routine. as a rule it is recommended that simultaneous use of the table read instructions should be avoided. however , in situations where simultaneous use cannot be avoided, the interrupts should be disabled prior to the execution of any main routine table-read instructions. note that all table related instructions require two instruction cycles to complete their operation. table read program example tempreg1 db ? ; temporary register #1 tempreg2 db ? ; temporary register #2 : : mov a,06h ; initialise low table pointer - note that this address is referenced mov tblp,a mov a,07h ; initialise high table pointer mov tbhp,a : : tabrd c tempreg1 ; transfers value in table referenced by table pointer data at program ; memory address 706h transferred to tempreg1 and tblh dec tblp ; reduce value of table pointer by one tabrd c tempreg2 ; transfers value in table referenced by table pointer data at program ; memory address 705h transferred to tempreg2 and tblh in this ; example the data 1ah is transferred to tempreg1 and data 0fh to ; register tempreg2 : : org 700h ; sets initial address of program memory dc 00ah, 00bh, 00ch, 00dh, 00eh, 00fh, 01ah, 01bh : :
rev. 1.00 ?? ? a ? 0 ?? ? 01 ? rev. 1.00 ?? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu in circuit programming the provision of flash type program memory provides the user with a means of convenient and easy upgrades a nd m odifcations t o t heir p rograms o n t he sa me d evice. as a n a dditional c onvenience, holtek has provided a means of programming the microcontroller in-circuit using a 4 -pin interface. this provides manufacturers with the possibility of manufacturing their circuit boards complete with a programmed or un-programmed microcontroller , and then programming or upgrading the program at a later stage. this enables product manufacturers to easily keep their manufactured products supplied with the latest program releases without removal and re-insertion of the device. the holtek flash mcu to w riter programming pin correspondence table is as follows: holtek write pins mcu programming pins function icpda pa0 serial address and data -- read/write icpck pa ? programming serial clock vdd vdd power suppl ? (5.0v) vss vss ground during the programming process, the user must there take care to ensure that no other outputs are connected to these two pins. the program memory and eeprom data memory can both be programmed serially in-circuit using this 4 -wire inte rface. dat a is downloaded and upl oaded serial ly on a single pin wit h an additi onal line for t he c lock. t wo a dditional l ines a re re quired for t he powe r suppl y. t he t echnical de tails regarding the in-circuit programming of the device are beyond the scope of this document and will be supplied in supplementary literature. during the programming process the p a0 and p a2 i/o pins for data and clock programming purposes. the user must there take care to ensure that no other outputs are connected to these two pins. * may be resistor or capacitor. the resistance of * must be greater than 1k or the capacitance of * must be less than 1nf.
rev. 1.00 ?? ?a? 0?? ?01? rev. 1.00 ?? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ram data memory the data memory is a volatile area of 8-bit wide ram internal memory and is the location where temporary information is stored. structure divided into two sections, the frst of these is an area of ram, known as the special function data memory. he re a re l ocated r egisters wh ich a re n ecessary f or c orrect o peration o f t he d evice. ma ny of these registers can be read from and written to directly under program control, however , some remain protected from user manipulation. the second area of data memory is known as the general purpose data memory , which is reserved for general purpose use. all locatio ns within this area are read and write accessible under program control. the overall data memory is subdivided into two banks for the device s . the special purpose data memory registers are accessible in all banks, with the exception of the eec register at address 40h, which is only accessible in bank 1. switching between the dif ferent data memory banks is achieved by setting the bank pointer to the correct value. the start address of the data memory for all devices is the address 00h. device capacity bank 0 bank 1 bs8 ? b08a- ? /bs8 ? b08a-4 1608 60h~ffh bs8 ? b1 ? a- ? /bs8 ? b1 ? a-4 ? 888 60h~ffh 80h~ffh bs8 ? b16a- ? /bs8 ? b16a-4 ? 888 60h~ffh 80h~ffh general purpose data memory special function register description most of the special function register details will be described in the relevant functional section, however several registers require a separate description in this section. indirect addressing registers C iar0, iar1 the indirect addressing registers, iar0 and iar1, although having their locations in normal ram register space, do not actually physically exist as normal registers. the method of indirect addressing for ram data manipulation uses these indirect addressing registers and memory pointers, in contrast to direct memory addressing, where the actual memory address is specifed. actions on the iar0 and iar1 registers will result in no actual read or write operatio n to these registers but rather to the memory location specifed by their corresponding memory pointers, mp0 or mp1. acting as a pair, iar0 and mp0 can together access data from bank 0 while the iar1 and mp1 register pair can access data from any bank. as the indirect addressing registers are not physically implemented, reading the indirect addressing registers indirectly will return a result of 00h and writing to the registers indirectly will result in no operation.
rev. 1.00 ? 4 ? a ? 0 ?? ? 01 ? rev. 1.00 ?5 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu                                                                                                          


        
            ?    ?    ?
?      ?    ?    ? ?                        ?      ?    ?    ?    ?    ?    ?    ?    ?                                                                                                    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?   ? ??????????     ?    ? ? ?  ?  
?   ?  ?   
?    ?  
?    ?   ?   ?   
?    ?  
?    ?   ?      ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?    ?                                                                                                                              


        
            ?    ?    ?
?      ?     ?    ? ?                        ?      ?    ?    ?    ?    ?    ?    ?    ?                                                                                                    ?    ?    ?    ?    ?    ?    ?    ?         ?    ?    ?    ?    ?  ?? ?????????     ?    ? ? ?  ?  
?   ?  ?   
?    ?  
?    ?   ?   ?   
?    ?  
?    ?   ?   ?   
?    ?  
?    ?   ?                         ?    ?    ?    ?    ?    ? special purpose data memory C bs83b08a-3/bs83b08a-4/bs83b12a-3/bs83b12a-4
rev. 1.00 ?4 ?a? 0?? ?01? rev. 1.00 ? 5 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu                                                                                                          


        
            ?    ?    ?
?      ?     ?    ? ?                        ?      ?    ?    ?    ?    ?    ?    ?    ?                                                                                                    ?    ?    ?    ?    ?    ?    ?    ?         ?    ?    ?    ?    ?  ?? ?????????     ?    ? ? ?  ?  
?   ?  ?   
?    ?  
?    ?   ?   ?   
?    ?  
?    ?   ?   ?   
?    ?  
?    ?   ?   ?   
?    ?  
?    ?   ?                      special purpose data memory C bs83b16a-3/BS83B16A-4                                                     general purpose data memory
rev. 1.00 ? 6 ? a ? 0 ?? ? 01 ? rev. 1.00 ?7 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu memory pointers C mp0, mp1 two me mory po inters, k nown a s mp0 a nd mp1 a re p rovided. t hese me mory po inters a re physically implemented in the data memory and can be manipulated in the same way as normal registers providing a convenient way with which to address and track data. when any operation to the releva nt indirect addressing registers is carried out, the actual address that the microcontroller is di rected to is the address specifed by the relat ed memory pointer . mp0, together with indirect addressing register , iar0, are used to access data from bank 0, while mp1 and iar1 are used to access data from all banks according to bp register. di rect ad dressing c an only be used with bank 0, all other banks must be addressed indirectly using mp1 and iar1. the following example shows how to clear a section of four data memory locations already defned as locations adres1 to adres4. indirect addressing program example data .section data adres1 db ? adres2 d b ? adres3 d b ? adres4 d b ? block d b ? code .section at 0 code org00h start : mov a , 04h ; setup size of block mov block , a mov a , offset adres1 ; accumulator loaded with frst ram address mov mp0 , a ; setup memory pointer with frst ram address loop : clr iar0 ; clear the data at address defned by mp0 inc mp0 ; increment memory pointer sdz block ; check if last memory location has been cleared jmp loop continue : the important point to note here is that in the example shown above, no reference is made to specifc data memory addresses.
rev. 1.00 ?6 ?a? 0?? ?01? rev. 1.00 ? 7 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bank pointer C bp for this device, the data memory is divided into two banks , bank0 and bank1 . selecting the required data memory area is achieved using the bank pointer . bit 0 of the bank pointer is used to select data memory banks 0~1. the data memory is initialised to bank 0 after a reset, except for a wd t time-out reset in the power down mode, in which case, the data memory bank remains unaf fected. it should be noted that the special function data memory is not af fected by the bank selection, which means that the special function regi sters ca n be ac cessed from wi thin any bank. di rectly addressi ng the da ta me mory will always result in bank 0 being accessed irrespective of the value of the bank pointer . accessing data from bank 1 must be implemented using indirect a ddressing. bp register bit 7 6 5 4 3 2 1 0 name d ? bp0 r/w r/w por 0 bit 7~1 unimplemented, read as "0" bit 0 dmbp0: select data memory banks 0: bank 0 1: bank 1 accumulator C acc the a ccumulator is central to the operation of any microcontroller and is clos ely related w ith operations carried out by the alu. the accumulator is the place where all intermediate results from the alu are stored. w ithout the accumulator it would be necessary to write the result of each c alculation or l ogical ope ration suc h a s a ddition, subt raction, shi ft, e tc., t o t he da ta me mory resulting i n highe r program ming and t iming overheads. da ta t ransfer operat ions usual ly i nvolve the t emporary st orage func tion of t he ac cumulator; for e xample, wh en t ransferring da ta be tween one user - defined register and another , it is necessary to do this by passing the data through the accumulator as no direct transfer between two registers is permitted. program counter low register C pcl to provide additional program control functions, the low byte of the program counter is made accessible to programmers by locating it within the special purpose area of the data memory . by manipulating this register , direct jumps to other program locations are easily implemented. loading a value directly into this pcl register will cause a jump to the specifed program memory location, however, as the register is only 8-bit wide, only jumps within the current program memory page are permitted. when such operations are used, note that a dummy cycle will be inserted. look-up table registers C tblp, tbhp, tblh these three special function registers are used to cont rol operation of the look-up table which is stored i n t he progra m me mory. t blp a nd t bhp a re t he t able poi nter s a nd i ndicate t he l ocation where the table data is located. their value must be setup before any table read commands are executed. their value can be changed, for example using the inc or dec instructions, allowing for easy table data pointing and reading. tblh is the location where the high order byte of the table data is stored afte r a table read data instruction has been executed. note that the lower order table data byte is transferred to a user defned location.
rev. 1.00 ? 8 ? a ? 0 ?? ? 01 ? rev. 1.00 ?9 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu status register C status this 8-bit register contains the zero fag (z), carry fag (c), auxiliary carry fag (ac), overfow fag (ov), power down fag (pdf), and watchdog time-out fag (t o). these arithmetic/logical operation and system management fags are used to record the status and operation of the microcontroller. with the exceptio n of the t o and pdf fags, bits in the status register can be altered by instructions like most other registers. any data written into the status register will not change the t o or pdf fag. in addition, operations related to the status register may give dif ferent results due to the dif ferent instruction operati ons. the t o fag can be af fected only by a system power -up, a wdt time-out or by executing the clr wdt or hal t instruction. the pdf fag is af fected only by executing the halt or clr wdt instruction or during a system power-up. the z, ov, ac and c fags generally refect the status of the latest operations. ? c is set if an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation; otherwise c is cleared. c is also af fected by a rotate through carry instruction. ? ac is set if an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction; otherwise ac is cleared. ? z is set if the result of an arithmetic or logical operation is zero; otherwise z is cleared. ? ov is set if an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit, or vice versa; otherwise ov is cleared. ? pdf is cleared by a system power -up or executing the clr wdt instruction. pdf is set by executing the halt instruction. ? to is cle ared by a system power -up or executing the clr wdt or hal t instruction. to is set by a wdt time-out. in additio n, on entering an interrup t sequence or executing a subroutine call, the status register will not be pushed onto the stack automatically . if the contents of the status registers are important and if the subroutine can corrupt the status register, precautions must be taken to correctly save it.
rev. 1.00 ?8 ?a? 0?? ?01? rev. 1.00 ? 9 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu status register bit 7 6 5 4 3 2 1 0 name to pdf ov z ac c r/w r r r/w r/w r/w r/w por 0 0 "x" unknown bit 7~6 unimplemented, read as "0" bit 5 to: w atchdog t ime-out fag 0: after power up or executing the "clr wdt" or "halt" instruction 1: a watchdog time-out occurred. bit 4 pdf: power down fag 0: after power up or executing the "clr wdt" instruction 1: by executing the "halt" instruction bit 3 ov: overfow fag 0: no overfow 1: an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit or vice versa. bit 2 z: zero fag 0: the result of an arithmetic or logical operation is not zero 1: the result of an arithmetic or logical operation is zero bit 1 ac: auxiliary fag 0: no auxiliary carry 1: an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction bit 0 c: carry fag 0: no carry-out 1: an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation c is also affected by a rotate through carry instruction.
rev. 1.00 ? 0 ? a ? 0 ?? ? 01 ? rev. 1.00 ?1 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu eeprom data memory one of the s pecial features in the device is its internal eep rom d ata m emory. eep rom, w hich stands for electrically erasable programmable read only memory , is by its nature a non-volatile form of memory , with data retention even when its pow er supply is removed. by incorporating this kind of data me mory, a whol e new host of appl ication possi bilities are made avail able to the designer. the availability of eeprom storage allows information such as product identification numbers, calibration values, specifc user data, system setup data or other product information to be stored directly within the product microcontroller . the process of reading and writing data to the eeprom memory has been reduced to a very trivial affair. eeprom data memory structure the eeprom data memory capacity is up to 648 bits. unlike the program memory and ram data memory , the eeprom data memory is not directly mapped and is therefore not directly accessible in the same way as the other types of memory . read and w rite operations to the eeprom are carried out in single byte operations using an address and data register in bank 0 and a single control register in bank 1. device capacity address bs8 ? b08a- ? /bs8 ? b08a-4 648 00h~ ? fh bs8 ? b1 ? a- ? /bs8 ? b1 ? a-4 648 00h~ ? fh bs8 ? b16a- ? /bs8 ? b16a-4 648 00h~ ? fh eeprom registers three registers control the overall operation of the internal eeprom data memory . these are the address register , eea, the data register , eed and a single control register , eec. as both the eea and eed registers are located in bank 0, they can be directly accessed in the same way as any other special functi on regist er. the eec register however , be ing located in bank1, cannot be di rectly addressed directly and can only be read from or written to indirectly using the mp1 memory pointer and indirect addressing register , iar1. because the eec control register is located at address 40h in bank 1, the mp1 memory pointer must frst be set to the value 40h and the bank pointer register , bp, set to the value, 01h, before any operations on the eec register are executed. eeprom control registers list name bit 7 6 5 4 3 2 1 0 eea d5 d4 d ? d ? d1 d0 eed d7 d6 d5 d4 d ? d ? d1 d0 eec wren wr rden rd eea register bit 7 6 5 4 3 2 1 0 name d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por unknown bit 7~6 unimplemented, read as "0" bit 5~0 data eeprom address data eeprom address bit 5~bit 0
rev. 1.00 ?0 ?a? 0?? ?01? rev. 1.00 ? 1 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu eed register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~0 data eeprom data data eeprom data bit 7~bit 0 eec register bit 7 6 5 4 3 2 1 0 name wren wr rden rd r/w r/w r/w r/w r/w por 0 0 0 0 bit 7~4 unimplemented, read as "0" bit 3 wren: data eeprom w rite enable 0: disable 1: enable this is the d ata eep rom w rite enable bit w hich mus t be s et high before d ata eeprom write operations are carried out. clearing this bit to zero will inhibit data eeprom write operations. bit 2 wr: eeprom w rite control 0: w rite cycle has fnished 1: activate a write cycle this i s t he da ta e eprom w rite c ontrol b it a nd wh en se t h igh b y t he a pplication program will activ ate a write cycle. this bit will be automatically reset to zero by the hardware after the write cycle has fnished. setting this bit high will have no ef fect if the wren has not frst been set high. bit 1 rden: data eeprom read enable 0: disable 1: enable this is the data eeprom read enable bit which must be set high before data eeprom read operations are carried out. clearing this bit to zero w ill inhibit d ata eeprom read operations. bit 0 rd: eeprom read control 0: read cycle has fnished 1: activate a read cycle this is the data eeprom read control bit and when set hi gh by the applic ation program will activ ate a read cycle. this bit will be automatically reset to zero by the hardware after the read cycle has fnished. setting this bit high will have no ef fect if the rden has not frst been set high. note: the wren, wr, rden and rd can not be set to 1 at the same time in one instruction. the wr and rd can not be set to 1 at the same time.
rev. 1.00 ?? ? a ? 0 ?? ? 01 ? rev. 1.00 ?? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu reading data from the eeprom to read data from the eep rom, the read enable bit, rden , in the eec register must frs t be set high to enable the read function. the eeprom address of the data to be read must then be placed in the eea register . if the rd bit in the eec register is now set high, a read cycle will be initiated. setting the rd bit high will not initiate a read operation if the rden bit has not been set. when the read cycle term inates, the rd bit will be automatically cleared to zero, after which the data can be read from the eed register . the data will remain in the eed register until another read or write operation i s e xecuted. t he a pplication pr ogram c an po ll t he rd bi t t o de termine whe n t he da ta i s valid for reading. writing data to the eeprom to wr ite da ta t o t he e eprom, t he wr ite e nable bi t, w ren, i n t he e ec re gister m ust frst be se t high to enable the w rite function. the eep rom addres s of the data to be w ritten mus t then be placed in the eea register and the data placed in the eed register . if the wr bit in the eec register is now set high, an internal write cycle will then be initiated. setting the wr bit high will not initiate a write cycle if the wren bit has not been set. as the eeprom write cycle is controlled using an internal timer whose operation is asynchronous to microcontroller system clock, a certain time will elapse before the data will have been written into the eeprom. detecting when the write cycle has fni shed c an be i mplemented e ither by pol ling t he w r bi t i n t he e ec re gister or by usi ng t he eeprom i nterrupt. w hen t he wr ite c ycle t erminates, t he w r b it wi ll b e a utomatically c leared t o zero by the microcontroller , informing the user that the data has been written to the eeprom. the application program can therefore poll the wr bit to determine when the write cycle has ended. write protection protection against inadvertent write operation is provided in several ways. after the device is powered-on t he w rite e nable b it i n t he c ontrol r egister wi ll b e c leared p reventing a ny wr ite operations. also at power -on the bank pointer , bp , will be reset to zero, which means that data memory bank 0 will be selected. as the eeprom control register is located in bank 1, this adds a further measure of protection against spurious write operations. during normal program operation, ensuring that the w rite enable bit in the control register is cleared will safeguard against incorrect write operations. eeprom interrupt the eeprom write interrupt is generated when an eeprom write cycle has ended. the eeprom interrupt must first be enabled by setting the dee bit in the relevant interrupt register . when an eeprom write cycle ends, the def request fag will be set. if the global, eeprom is enabled and the stack is not full, a jump to the associated interrupt vector will take place. when the interrupt is serviced, t he e eprom i nterrupt fa g will a utomatically reset. mo re d etails c an b e o btained i n t he interrupt section.
rev. 1.00 ?? ?a? 0?? ?01? rev. 1.00 ?? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu programming considerations care must be taken that data is not inadvertently written to the eeprom. protection can be periodic by ensuring that the w rite enable bit is normally cleared to zero when not writing. also the bank pointer could be normally cleared to zero as this would inhibit access to bank 1 where the eeprom control register exist. although certainly not necessary , consideration might be given in the application program to the checking of the validity of new write data by a simple read back process. when writing data the wr bit must be set high immediately after the wren bit has been set high, to ensure the write cycle executes correctly . the global interrupt bit emi should also be cleared before a write cycle is executed and then re-enabled after the write cycle starts. programming examples reading data from the eeprom C polling method mov a, eeprom_adres ; user defned address mov eea, a mov a, 040h ; setup memory pointer mp1 mov mp1, a ; mp1 points to eec register mov a, 01h ; setup bank pointer mov bp, a set iar1.1 ; set rden bit, enable read operations set iar1.0 ; start read cycle - set rd bit back: sz iar1.0 ; check for read cycle end jmp back clr iar1 ; disable eeprom write clr bp mov a, eed ; move read data to register mov read_data, a writing data to the eeprom C polling method clr emi mov a, eeprom_adres ; user defned address mov eea, a mov a, eeprom_data ; user defned data mov eed, a mov a, 040h ; setup memory pointer mp1 mov mp1, a ; mp1 points to eec register mov a, 01h ; setup bank pointer mov bp, a set iar1.3 ; set wren bit, enable write operations set iar1.2 ; start write cycle - set wr bit set emi back: sz iar1.2 ; check for write cycle end jmp back clr iar1 ; disable eeprom write clr bp
rev. 1.00 ? 4 ? a ? 0 ?? ? 01 ? rev. 1.00 ?5 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu oscillator various oscillator options of fer the user a wide range of functions according to their various application requirements. the flexible features of the oscillator functions ensure that the best optimisation can be achieved in terms of speed and power saving. oscillator selections and operation are selected through registers. oscillator overview in additio n to being the source of the main system clock the oscillators also provide clock sources for the watchdog t imer and t ime base interrupts. f ully integrated inte rnal oscillators, requiring no external components, are provided to form a wide range of both fast and slow system oscillators. the h igher f requency o scillators p rovide h igher p erformance b ut c arry wi th i t t he d isadvantage o f higher power requirements, while the opposite is of course true for the lower frequency oscillators. with the capabilit y of dynamically switching between fast and slow system clock, the device has the fexibility to optim ize the performance/power ratio, a feature especially important in power sensitive portable applications. type name freq. internal high speed rc hirc 8/1 ? /16 ? hz internal low speed rc lirc ?? khz oscillator types system clock confgurations there are t wo m ethods of generat ing t he syst em cl ock, a high spee d osci llator and a low spee d oscillator. the high speed oscillator is the internal 8mhz, 1 2mhz, 16 mhz rc oscillator . the low speed os cillator is the internal 32khz (lirc) oscillator . selecting whether the low or high speed oscillator is us ed as the s ystem os cillator is implemented us ing the h lclk bit and ck s2~cks0 bits in the smod register and as the system clock can be dynamically selected. the actua l source clock used for the high speed and the low speed oscillators is chosen via registers . the frequency of the slow speed or high speed system clock is also determined using the hlclk bit and cks2~cks0 bit s i n t he smod regist er. note t hat t wo osci llator sel ections m ust be made namely one high speed and one low speed system oscillators. it is not possible to choose a no-oscillator selection for either the high or low speed oscillator. high speed oscillator hirc lirc low speed oscillator f h 6- stage prescaler hlclk ? cks ?~ cks 0 bits f h /? f h /4 f h /8 f h / 16 f h / ?? f h / 64 f sub f sys system clock confgurations
rev. 1.00 ?4 ?a? 0?? ?01? rev. 1.00 ? 5 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu internal rc oscillator C hirc the internal rc oscillator is a fully integrated system oscillator requiring no external components. the i nternal rc osc illator ha s a powe r on de fault fre quency of 8mhz but c an be se lected t o be either 8mhz, 12mhz or 16mhz using the hircs1 and hircs0 bits in the ctrl register . device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the infuence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. internal 32khz oscillator C lirc the internal 32khz system oscillator is the low frequency oscillator . it is a fully integrated rc osc illator wi th a t ypical fre quency of 32khz a t 5v , re quiring no e xternal c omponents for i ts implementation. device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the infuence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. after power on this lirc oscillator will be permanently enabled; there is no provision to disable the oscillator using . operating modes and system clocks present day appl ications require that their mi crocontrollers have high performance but often sti ll demand that they consume as little power as possible, conficting requirements that are especially true i n ba ttery powe red por table a pplications. t he fa st c locks re quired for hi gh pe rformance wi ll by t heir na ture i ncrease c urrent c onsumption a nd of c ourse vi ce-versa, l ower spe ed c locks re duce current consumption. as holtek has provided this device with both high and low speed clock sources and the means to switch between them dynamically , the user can optimise the operation of their microcontroller to achieve the best performance/power ratio. system clocks the main system clock, can come from either a high frequency , f h , or low frequency , f sub , source, and is selected using the hlclk bit and cks2~cks0 bits in the smod register . both the high and low speed system clocks are sourced from internal rc oscillators.
rev. 1.00 ? 6 ? a ? 0 ?? ? 01 ? rev. 1.00 ?7 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu system clock confgurations note: when the system clock source f sys is switched to f sub from f h , the high speed oscillation will stop to conserve the power. thus there is no f h ~f h /64 for peripheral circuit to use. there a re five d ifferent m odes o f o peration f or t he m icrocontroller, e ach o ne wi th i ts o wn special characteristics and which can be chosen according to the specific performance and power requirements of the appl ication. there are two modes all owing normal operati on of the microcontroller, the normal mode and slow mode. the remaining three modes, the sleep , idle0 and idle1 mode are used when the microcontroller cpu is switched off to conserve power. n or ? al mode on f h ~f h /64 on on slow mode on f sub on on ilde0 mode off off on on idle1 mode off on on on sleep mode off off on on
rev. 1.00 ?6 ?a? 0?? ?01? rev. 1.00 ? 7 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu normal mode as the name suggests this is one of the main operating modes where the microcontroller has all of its functions operational and where the system clock is provided by the high speed oscillator . this mode operates allo wing the microco ntroller to operate normally with a clock source will come from the high speed oscillator , hirc. the high speed oscillator will however frst be divided by a ratio ranging from 1 to 64, the actual ratio being selected by the cks2~cks0 and hlclk bits in the smod regis ter. a lthough a high s peed os cillator is us ed, running the microcontroller at a divided clock ratio reduces the operating current. slow mode this is also a mode where the microcontroller operates normally altho ugh now with a slower speed clock so urce. t he c lock so urce u sed wi ll b e f rom f sub . r unning t he m icrocontroller i n t his m ode allows it to run with much lower operating currents. in the slow mode, the f h is off. sleep mode the sleep mode is entered when an hal t instruction is executed and when the idlen bit in the smod register is low . in the sleep mode the cpu will be stopped. however the f sub clocks will continue to run the w atchdog t imer will continue to operate . idle0 mode the idle0 mode is entered when a hal t instruction is executed and when the idlen bit in the smod regi ster i s high and t he fsyson bit i n t he ctrl register i s l ow. in t he idle 0 mode t he system oscillator will be stop and will therefore be inhibited from driving the cpu. idle1 mode the idle1 mode is entered when a hal t instruction is executed and when the idlen bit in the smod registe r is high and the fsyson bit in the ctrl register is high. in the idle1 mode the system oscillator will be inhibited from driving the cpu but may continue to provide a clock source to keep some peripheral functions operational. in the idle1 mode, the system oscillator will continue to run, and this system oscillator may be the high speed or low speed system oscillator.
rev. 1.00 ? 8 ? a ? 0 ?? ? 01 ? rev. 1.00 ?9 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu control register the smod register is used to control the internal clocks within the device. smod register bit 7 6 5 4 3 2 1 0 name cks ? cks1 cks0 lto hto idlen hlclk r/w r/w r/w r/w r r r/w r/w por 0 0 0 0 0 1 1 bit 7~5 cks2~cks0: the system clock selection when hlclk is 0 000: f sub (f lirc ) 001: f sub (f lirc ) 010: f /64 011: f /32 100: f /16 101: f /8 110: f /4 111: f /2 these three bits are used to select which clock is used as the system clock source. in addition to the system clock source, which can be lirc, a divided version of the high speed system oscillator can also be chosen as the system clock source. bit 4 unimplemented, read as 0 bit 3 lto: lirc system osc sst ready fag 0: not ready 1: ready this is the low speed system oscillator sst ready fag which indicate s when the low speed system oscillator is stable after power on reset or a wake-up has occurred. the fag will change to a high level after 1~2 cycles. bit 2 hto: hirc system osc sst ready fag 0: not ready 1: ready this is the high speed system oscill ator sst ready fag which indicates when the high speed system oscillator is stable after a wake-up has occurred. this fag is cleared to 0 by hardware when the device is powered on and then changes to a high level after the h igh sp eed sy stem o scillator i s stable. herefore t his fag wi ll a lways b e r ead a s 1 by the application program after device power -on. the fag will be low when in the sleep or idle 0 mode but after power on reset or a wake-up has occurred, the fag will change to a high level after 15~16 clock cycles if the hirc oscillator is used. bit 1 idlen: idle mode control 0: disable 1: enable this is the idle mode control bit and determines what happens when the hal t instruction is executed. if this bit is high, when a hal t instruction is executed the device wi ll e nter t he idle mo de. i n t he i dle1 mo de t he c pu wi ll st op r unning but t he syst em c lock wi ll c ontinue t o keep t he pe ripheral fun ctions ope rational, i f fsyson bit is high. if fsyson bit is low, the cpu and the system clock will all stop in idle0 mode. if the bit is low the device will enter the sleep mode when a hal t instruction is executed. bit 0 hlclk: system clock selection 0: f /2~f /64 or f sub 1: f this bit is used to select if the f clock or the f /2~f /64 or f s ub clock is used as the system clock. when the bit is high the f clock will be selected and if low the /2~f /64 or f s ub clock will be selected. when system clock switches from the f clock to the f s ub clock and the f clock will be automatically switched off to conserve power.
rev. 1.00 ?8 ?a? 0?? ?01? rev. 1.00 ? 9 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ctrl register bit 7 6 5 4 3 2 1 0 name fsyson hircs1 hircs0 lvrf lrf wrf r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 unknow b it 7 fsyson: f sys control in idle mode 0: disable 1: enable bit 6 unimplemented, read as "0" bit 5~4 hircs1~hircs0: high frequency clock select 00: 8mhz 01: 16mhz 10: 12mhz 11: 8mhz bit 3 unimplemented, read as "0" bit 2 lvrf: lvr function reset fag 0: not occur 1: occurred this bit is set to 1 when a specifc low v oltage reset situation condition occurs. this bit can only be cleared to 0 by the application program. bit 1 lrf: lvrc control register software reset fag 0: n ot occur 1: occurred this bit is set to 1 if the l vrc register contains any non defned l vr voltage register values. this in ef fect acts like a software reset function. this bit can only be cleared to 0 by the application program. bit 0 wrf: wdt control register software reset fag 0: not occur 1: occurred this bit is set to 1 by the wdt control register software reset and cleared by the application pr ogram. not e t hat t his bi t c an on ly be c leared t o 0 by t he a pplication program.
rev. 1.00 40 ? a ? 0 ?? ? 01 ? rev. 1.00 41 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu operating mode switching the devi ce c an swi tch bet ween opera ting m odes dynam ically al lowing t he use r t o se lect t he best performance/power ratio for the pres ent task in hand. in this w ay microcontroller operations that do not require high performance can be executed using slower clocks thus requiring less operating current and prolonging battery life in portable applications. in simple terms, mode switching between the normal mode and slow mode is executed using the hlclk bit and cks2~cks0 bits in the smod register while mode switching from the normal/slow modes to the sleep/idle modes is executed via the hal t instruction . when a hal t instructio n is executed, whether the device enters the idle mode or the sleep mode is determined by the condit ion of the idl en bit in the smod regi ster and fsyson in the ctrl register. when the hlclk bit switches to a low level, which implies that clock source is switched from the high speed clock source, f h , to the clock source, f h /2~f h /64 or f sub . if the clock is from the f sub , the high speed clock source will stop running to conserve power . when this happens it must be noted that the f h /16 and f h /64 internal clock sources will also stop running . the accompanying fowchart shows what happens when the device moves between the various operating modes.
rev. 1.00 40 ?a? 0?? ?01? rev. 1.00 41 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu normal mode to slow mode switching when r unning i n t he nor mal mo de, wh ich u ses t he h igh sp eed sy stem o scillator, a nd t herefore consumes m ore powe r, t he syst em c lock c an swi tch t o run i n t he sl ow mode by se t ting t he hlclk bit to 0 and set ting the cks2~cks0 bits to 000 or 001 in the smod register .this will then use the low speed system oscillator which will consume less power . users may decide to do this for certain operations which do not require high performance and can subsequently reduce power consumption. the slow mode is sourced from the lirc oscillator and therefore requires this oscillator to be stable before full mode switching occurs. this is monitored using the lto bit in the smod register. slow mode to normal mode switching in slow mode the system uses lirc low speed system oscillator . t o switch back to the normal mode, w here the high s peed s ystem os cillator is us ed, the h lclk bit s hould be s et to 1 or hlclk bit is 0, but cks2~cks0 is set to 010, 01 1, 100, 101, 1 10 or 1 11. as a certain amount of time will be required for the high frequency clock to stabilise, the status of the hto b it i s c hecked. t he a mount o f t ime r equired f or h igh sp eed sy stem o scillator st abilization depends upon which high speed system oscillator type is used. entering the sleep mode there is only one way for the device to enter the sleep mode and that is to execute the hal t instruction in the application program with the idlen bit in smod register equal to 0. when this instruction is executed under the conditions described above, the following will occur: ? the system clock and t ime base clock will be stopped and the application program will stop at the halt instruction , but the f sub clock will be on. ? the data memory contents and registers will maintain their present condition. ? the wdt will be cleared and resume counting. ? the i/o ports will maintain their present conditions. ? in the status register , the power down fag, pdf , will be set and the w atchdog time-out fag, t o, will be cleared. entering the idle0 mode there is only one way for the device to enter the idle0 mode and that is to execute the hal t instruction i n t he a pplication p rogram wi th t he i dlen b it i n smod r egister e qual t o 1 a nd t he fsyson bit in ctrl register equal to 0. when this instruction is executed under the conditions described above, the following will occur: ? the system clock will be stopped and the application program will stop at the hal t instruction, but the t ime base and the low frequency f sub clock will be on. ? the data memory contents and registers will maintain their present condition. ? the wdt will be cleared and resume counting. ? the i/o ports will maintain their present conditions. ? in the status register , the power down fag, pdf , will be set and the w atchdog time-out fag, t o, will be cleared.
rev. 1.00 4 ? ? a ? 0 ?? ? 01 ? rev. 1.00 4? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu entering the idle1 mode there is only one way for the device to enter the idle1 mode and that is to execute the hal t instruction i n t he a pplication p rogram wi th t he i dlen b it i n smod r egister e qual t o 1 a nd t he fsyson bit in ctrl register equal to 1. when this instruction is executed under the conditions described above, the following will occur: ? the system clock and the low frequency f sub will be on and the applic ation program will stop at the halt instruction. ? the data memory contents and registers will maintain their present condition. ? the wdt will be cleared and resume counting . ? the i/o ports will maintain their present conditions. ? in the status register , the power down fag, pdf , will be set and the w atchdog time-out fag, t o, will be cleared.                           
                           ?? ?      ??       ? ? ?        ?? ?     ??       ? ? ?        ?? ?      ??  
rev. 1.00 4? ?a? 0?? ?01? rev. 1.00 4 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu                         
                              ? ? ??     ????      ? ?       ? ? ??     ????      ? ?       ? ? ??     ???? standby current considerations as the main reason for entering the sleep or idle mode is to keep the current consumption of the device to as low a value as possible, perhaps only in the order of several micro-amps except in the idle1 mode , t here a re ot her c onsiderations whi ch m ust a lso be t aken i nto a ccount by t he c ircuit designer if the power consumption is to be minimised. special attention must be made to the i/o pins on the device. all high-impedance input pins must be connected to either a fxed high or low level as any foating input pins could create internal oscillations and result in increased current consumption. this also applies to devices which have dif ferent package types, as there may be unbonbed pins. these must either be setup as outputs or if setup as inputs must have pull-high resistors connected. care must also be taken with the loads, which are connected to i/o pins, which are setup as outputs. t hese shoul d be pl aced i n a c ondition i n whi ch m inimum c urrent i s dra wn or c onnected only to external circuits that do not draw current, such as other cmos inputs. in the idle1 mode the system oscillator is on, if the system oscillator is from the high speed system oscillator , the additional standby current will also be perhaps in the order of several hundred micro-amps .
rev. 1.00 44 ? a ? 0 ?? ? 01 ? rev. 1.00 45 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu wake-up after the system enters the sleep or idle mode, it can be woken up from one of various sources listed as follows: ? an external reset ? an external falling edge on port a ? a system interrupt ? a wdt overfow if the system is woken up by an external reset, the device will experience a full system reset, however, i f the device is woken up by a wdt overfow , a w atchdog t imer reset will be initiated. although both of these wake-up methods will initiate a reset operation, t he actual source of the wake-up can be determined by examining the t o and pdf flags. the pdf flag is cleared by a system power -up or executing the clear w atchdog t imer instructions and is set when executing the halt instruction. the t o fag is set if a wdt time-out occurs, and causes a wake-up that only resets the program counter and stack pointer, the other fags remain in their original status. each pin on port a can be setup using the p awu register to permit a negative transition on the pin to wake-up t he syste m. when a port a pin wake-up occurs, the progra m wil l resume exec ution at the i nstruction f ollowing t he halt i nstruction. i f t he sy stem i s wo ken u p by a n i nterrupt, t hen two possible situations may occur . the frst is where the related interrupt is disabled or the interrupt is enabled but the stack is full, in which case the program will resume execution at the instruction following the hal t instruction. in this situation, the interrupt which woke-up the device will not be immediately serviced, but will rather be serviced later when the related interrupt is fnally enabled or when a stack level becomes free. the other situation is where the related interrupt is enabled and the stack is not full, in which case the regular interrupt response takes place. if an interrupt request flag i s se t hi gh be fore e ntering t he sle ep or idl e mode, t he wa ke-up func tion of t he re lated interrupt will be disabled. system oscillator wake-up time (sleep mode) wake-up time (idle0 mode) wake-up time (idle1 mode) hirc 15~16 hirc c ? cles 1~ ? hirc c ? cles lirc 1~ ? lirc c ? cles 1~ ? lirc c ? cles wake-up time programming considerations the high speed and low speed oscillators both use the same sst counter . for example, if the system is woken up from the sleep mode the hirc oscillator needs to start-up from an off state. if the device is woken up from the sleep mode to the no rmal mode, the high speed system oscillator needs an sst period. the device will execute the frst instruction after hto is high.
rev. 1.00 44 ?a? 0?? ?01? rev. 1.00 45 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu watchdog timer the w atchdog t imer is provided to prevent program malfunctions or sequences from jumping to unknown locations, due to certain uncontrollable external events such as electrical noise. watchdog timer clock source the w atchdog t imer clock source is provided by the internal f s ub clock which is in turn supplied by the lirc oscillator . the w atchdog t imer source clock is then subdivided by a ratio of 2 8 t o 2 18 t o gi ve l onger t imeouts, t he a ctual va lue be ing c hosen usi ng t he w s2~ws0 bi ts i n t he w dtc register. the lirc internal oscillato r has an approximate period of 32khz at a supply voltage of 5v . however, it should be noted that this specifed internal clock period can vary with v dd , temperature and process variations. watchdog timer control register a single register , wdtc, controls the required timeout period as well as the enable operation . the wdtc register is initiated to 0101001 1b at any res et but keeps unchanged at the wd t time-out occurrence in a power down state. wdtc register bit 7 6 5 4 3 2 1 0 name we4 we ? we ? we1 we0 ws ? ws1 ws0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 0 1 1 bit 7~3 wdt function software control 10101b: enabled 01010b: enabled (default) other v alues: r eset mc u ( reset wi ll b e a ctive a fter 2 ~3 l irc c lock f or d ebounce t ime.) if the mcu reset caused by the we [4:0] in wdtc software reset, the wrf fag of ctrl register will be set. bit 2~0 wdt t ime-out period selection 000: 2 8 /f sub 001: 2 10 /f sub 010: 2 12 /f sub 011: 2 14 /f sub 100: 2 15 /f sub 101: 2 16 /f sub 110: 2 17 /f sub 111: 2 18 /f sub these three bits determine the divis ion ratio of the watchdog t imer s ource clock, which in turn determines the timeout period.
rev. 1.00 46 ? a ? 0 ?? ? 01 ? rev. 1.00 47 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ctrl register bit 7 6 5 4 3 2 1 0 name fsyson hircs1 hircs0 lvrf lrf wrf r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 unknown b it 7 fsyson: sys control idle mode describe elsewhere bit 6 unimplemented, read as 0 bit 5~4 hircs1~hircs0: high frequency clock select describe elsewhere bit 3 unimplemented, read as 0 bit 2 lvrf: lvr function reset fag describe elsewhere bit 1 lrf: lvr control register software reset fag describe elsewhere bit 0 wrf: wdt control register software reset fag 0: not occur 1: occurred this bit is set to 1 by the wdt control register software reset and cleared by the application pr ogram. not e t hat t his bi t c an on ly be c leared t o 0 by t he a pplication program. watchdog timer operation in these devices the w atchdog t imer supplied by the f sub oscillator and is therefore always on. the w atchdog t imer ope rates by provi ding a de vice re set whe n i ts t imer ove rfows. t his m eans that i n t he a pplication pro gram a nd dur ing nor mal ope ration t he use r ha s t o st rategically c lear t he watchdog t imer before it overfows to prevent the w atchdog t imer from executing a reset. this is done using the cle ar watchdog instructions. if the program malfunction s for whatever reason, jumps to an unknown location, or enters an endless loop, the clear wdt instruction will not be executed in the correct manne r, in which case the w atchdog t imer will overfow and reset the device. there are fve bits, we4~we0, in the wdtc register to enable the wdt function. when the we4~we0 bits value is equal to 01010b or 10101b, the wdt function is enabled. however , if the we4~we0 bits are changed to any other values except 01010b and 10101b, which is caused by the environmental noise, it will reset the microcontroller after 2~3 lirc clock cycles. under norm al progra m ope ration, a w atchdog t imer t ime-out wi ll i nitialise a de vice re set a nd se t the status bit t o. however , if the system is in the sleep or idle mode, when a w atchdog t imer time-out occurs, the t o bit in the status register will be set and only the program counter and stack pointer will be reset. four methods can be adopted to clear the contents of the w atchdog t imer. the frst is a wdt reset, which means a certain value is written into the we4~we0 bit fled except 01010b a nd 10101b, t he second i s usi ng t he w atchdog t imer soft ware c lear i nstructions a nd t he third is via a halt instruction. there is only one method of using software instruction to clear the w atchdog t imer. that is to use the single clr wdt instruction to clear the wdt . the maximum time-out period is when the 2 18 division ratio is selected. as an example, with a 32khz lirc oscillator as its source clock, this will give a maximum watchdog period of around 8 seconds for the 2 18 division ratio, and a minimum timeout of 7.8ms for the 2 8 division ration.
rev. 1.00 46 ?a? 0?? ?01? rev. 1.00 47 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu                
  
   
   

  
   
   
   
   
      ? ?? ?? ?  ? - 
 ?   ?  
 ?   
 ? ?? ?           watchdog timer reset and initialisation a reset function is a fundamental part of any microcontroller ensuring that the device can be set to some predetermined condition irrespective of outside parameters. the most important reset condition is after power is frst applied to the microcontroller . in this case, internal circuitry will ensure that the mi crocontroller, after a short del ay, will be in a well defined state and rea dy to execute t he fr st p rogram i nstruction. af ter t his p ower-on r eset, c ertain i mportant i nternal r egisters will be set to defned states before the program commences. one of these registers is the program counter, which will be reset to zero forcing the microcontroller to begin program execution from the lowest program memory address. another type of reset is w hen the w atchdog t imer overflow s and resets the microcontroller . a ll typesof reset operations result in dif ferent register conditions being setup. another reset exists in the form of a low v oltage reset, l vr, where a full reset is implemented in situations where the power supply voltage falls below a certain threshold. reset functions there are fve ways in which a microcontroller reset can occur, through events occurring internally: ? power-on reset the most fundamental and unavoidable reset is the one that occurs afte r power is frst applied to the microcontroller. as well as ensuring that the program memory begins execution from the frst memory address, a power -on reset also ensures that certain other registers are preset to known conditions. all the i/o port and port control registers will power up in a high condition ensuring that all pins will be frst set to inputs. vdd power-on reset sst time-out t rstd power-on reset timing chart
rev. 1.00 48 ? a ? 0 ?? ? 01 ? rev. 1.00 49 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ? low v oltage reset C lvr the micr ocontroller contains a low voltage reset circuit in order to monitor the supply voltage of the device . the l vr function is always enabled with a specifc l vr voltage, v lvr . if the supply voltage of the device drops to within a range of 0.9v~ v lvr such as might occur when changing the battery , the l vr will automatically reset the device internally and the l vrf bit in the ctrl register will also be set to1 . f or a valid l vr signal , a low volt age, i.e., a volt age in the range between 0.9v~ v lvr must exist for greater than the value t lvr specifed in the a.c. characteristics. if the low voltage state does not exceed this value , the l vr will ignore the low supply voltage and wi ll not pe rform a re set func tion. the a ctual v lvr i s se t by t he l vrc re gister. w hen t his happens, the lrf bit in the ctrl register will be set to 1. low voltage reset timing chart lvrc register C bs83b08a-3/bs83b12a-3/bs83b16a-3 bit 7 6 5 4 3 2 1 0 name lvs7 lvs6 lvs5 lvs4 lvs ? lvs ? lvs1 lvs0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 1 0 1 bit 7 lvr v oltage select control 01010101: 2.55v(default) 00110011: 2.55v 10011001: 2.55v 10101010: 2.55v other values: mcu reset (reset will be active after 2~3 lirc clock for debounce time) note: s/w can write 00h~ffh to control l vr voltage, even to s/w reset mcu. if the mcu reset caused l vrc software reset, the lrf fag of ctrl register will be set. lvrc register C bs83b08a-4/bs83b12a-4/BS83B16A-4 bit 7 6 5 4 3 2 1 0 name lvs7 lvs6 lvs5 lvs4 lvs ? lvs ? lvs1 lvs0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 1 0 1 bit 7 lvr v oltage select control 01010101: 2.10v(default) 00110011: 2.10v 10011001: 2.10v 10101010: 2.10v other values: mcu reset (reset will be active after 2~3 lirc clock for debounce time) note: s/w can write 00h~ffh to control l vr voltage, even to s/w reset mcu. if the mcu reset caused l vrc software reset, the lrf fag of ctrl register will be set.
rev. 1.00 48 ?a? 0?? ?01? rev. 1.00 49 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ctrl register bit 7 6 5 4 3 2 1 0 name fsyson hircs1 hircs0 lvrf lrf wrf r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 unknown b it 7 fsyson: sys control idle mode describe elsewhere bit 6 unimplemented, read as 0 bit 5~4 hircs1~hircs0: high frequency clock select describe elsewhere bit 3 unimplemented, read as 0 bit 2 lvrf: lvr function reset fag 0: not occur 1: occurred this bit is set to 1 when a specifc low v oltage reset situation condition occurs. this bit can only be cleared to 0 by the application program. bit 1 lrf: lvr control register software reset fag 0: not occur 1: occurred this bit is set to 1 if the l vrc register contains any non defned l vr voltage register values. this in ef fect acts like a software reset function. this bit can only be cleared to 0 by the application program. bit 0 wrf: wdt control register software reset fag describe elsewhere
rev. 1.00 50 ? a ? 0 ?? ? 01 ? rev. 1.00 51 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ? watchdog t ime-out reset during normal operation the w atchdog time-out reset during normal operation is the same as a lvr reset except that the watchdog time-out fag t o will be set to 1. note: t rstd is power-on delay, typical time=16.7ms wdt time-out reset during normal operation timing chart ? watchdog t ime-out reset during sleep or idle mode the w atchdog tim e-out reset during sleep or idle mode is a little dif ferent from other kinds of reset. most of the conditions remain unchanged except that the program counter and the stack pointer will be cleared to 0 and the t o fag will be set to 1. refer to the a.c. characteristics for t sst details. note: the t sst is 15~16 clock cycles if the system clock source is provided by the hirc. the t sst is 1~2 clock for the lirc. wdt time-out reset during sleep or idle timing chart reset initial conditions the dif ferent types of res et des cribed af fect the res et fags in dif ferent ways. thes e fags , know n as pdf and t o are located in the status register and are controlled by various microcontroller operations, such as the sleep or idle mode function or w atchdog t imer. the reset flags are shown in the table: to pdf reset conditions 0 0 power-on reset u u lvr reset during nor ? al or slow ? ode operation 1 u wdt time-out reset during nor ? al or slow ? ode operation 1 1 wdt time-out reset during idle or sleep ? ode operation u stands for unchanged the following table indicates the w ay in w hich the various components of the microcontroller are affected after a power-on reset occurs. item condition after reset program counter reset to zero interrupts all interrupts will be disabled wdt clear after reset ? wdt begins counting timer/eventer counter timer/eventer counter will be turned off input/output ports i/o ports will be setup as inputs stack pointer stack pointer will point to the top of the stack the dif ferent kinds of resets all af fect the internal registers of the microcontroller in dif ferent ways. to ensure reliable continuation of normal program execution after a reset occurs, it is important to know wh at c ondition t he m icrocontroller i s i n a fter a p articular r eset o ccurs. t he f ollowing t able describes how each type of reset affects each of the microcontroller internal registers.
rev. 1.00 50 ?a? 0?? ?01? rev. 1.00 51 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bs83b08a-3/bs83b08a-4 register register lvr&power on wdt overfow (normal mode) wdt overfow (halt mode) iar0 ---- ---- ---- ---- ---- ---- ? p0 xxxx xxxx xxxx xxxx uuuu uuuu iar1 ---- ---- ---- ---- ---- ---- ? p1 xxxx xxxx xxxx xxxx uuuu uuuu bp ---- ---0 ---- ---0 ---- ---u acc xxxx xxxx uuuu uuuu uuuu uuuu pcl 0000 0000 0000 0000 0000 0000 tblp xxxx xxxx uuuu uuuu uuuu uuuu tblh xxxx xxxx uuuu uuuu uuuu uuuu tbhp ---- xxxx ---- uuuu ---- uuuu status --00 xxxx --1u uuuu --11 uuuu s ? od 0000 0011 0000 0011 uuuu uuuu ctrl 0-00 -x00 0-00 -x00 u-uu -uuu integ ---- --00 ---- --00 ---- --uu intc0 -000 0000 -000 0000 -uuu uuuu intc1 -000 -000 -000 -000 -uuu -uuu lvrc 0101 0101 0101 0101 uuuu uuuu pa 1--1 1111 1--1 1111 u--u uuuu pac 1--1 1111 1--1 1111 u--u uuuu papu 0--0 0000 0--0 0000 u--u uuuu pawu 0--0 0000 0--0 0000 u--u uuuu wdtc 0101 0011 0101 0011 uuuu uuuu tbc --00 ---- --00 ---- --uu ---- t ? r 0000 0000 0000 0000 uuuu uuuu t ? rc --00 -000 --00 -000 --uu -uuu eea --11 1111 --11 1111 --uu uuuu eed 0000 0000 0000 0000 uuuu uuuu pb 1111 1111 1111 1111 uuuu uuuu pbc 1111 1111 1111 1111 uuuu uuuu pbpu 0000 0000 0000 0000 uuuu uuuu i ? ctoc 0000 0000 0000 0000 uuuu uuuu si ? c0 0000 -00- 0000 -00- uuuu -uu- si ? c1 0000 -000 0000 -000 uuuu -uuu si ? d 0000 0000 0000 0000 uuuu uuuu si ? c ? --11 1111 --11 1111 --uu uuuu si ? a 0000 0000 0000 0000 uuuu uuuu tkt ? r 0000 0000 0000 0000 uuuu uuuu tkc0 -000 0000 -000 0000 -uuu uuuu tk16dl 0000 0000 0000 0000 uuuu uuuu tk16dh 0000 0000 0000 0000 uuuu uuuu tkc1 ---- --11 ---- --11 ---- --uu tk ? 016dl 0000 0000 0000 0000 uuuu uuuu tk ? 016dh 0000 0000 0000 0000 uuuu uuuu tk ? 0rol 0000 0000 0000 0000 uuuu uuuu tk ? 0roh ---- --00 ---- --00 ---- --uu tk ? 0c0 0000 0000 0000 0000 uuuu uuuu
rev. 1.00 5 ? ? a ? 0 ?? ? 01 ? rev. 1.00 5? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu register lvr&power on wdt overfow (normal mode) wdt overfow (halt mode) tk ? 0c1 0-00 0000 0-00 0000 u-uu uuuu tk ? 116dl 0000 0000 0000 0000 uuuu uuuu tk ? 116dh 0000 0000 0000 0000 uuuu uuuu tk ? 1rol 0000 0000 0000 0000 uuuu uuuu tk ? 1roh ---- --00 ---- --00 ---- --uu tk ? 1c0 0000 0000 0000 0000 uuuu uuuu tk ? 1c1 0000 0000 0000 0000 uuuu uuuu eec ---- 0000 ---- 0000 ---- uuuu note: - not implement u stands for unchanged x stands for unknown bs83b12a-3/bs83b12a-4 register register lvr&power on wdt overfow (normal mode) wdt overfow (halt mode) iar0 ---- ---- ---- ---- ---- ---- ? p0 xxxx xxxx xxxx xxxx uuuu uuuu iar1 ---- ---- ---- ---- ---- ---- ? p1 xxxx xxxx xxxx xxxx uuuu uuuu bp ---- ---0 ---- ---0 ---- ---u acc xxxx xxxx uuuu uuuu uuuu uuuu pcl 0000 0000 0000 0000 0000 0000 tblp xxxx xxxx uuuu uuuu uuuu uuuu tblh xxxx xxxx uuuu uuuu uuuu uuuu tbhp ---- xxxx ---- uuuu ---- uuuu status --00 xxxx --1u uuuu --11 uuuu s ? od 0000 0011 0000 0011 uuuu uuuu ctrl 0-00 -x00 0-00 -x00 u-uu -uuu integ ---- --00 ---- --00 ---- --uu intc0 -000 0000 -000 0000 -uuu uuuu intc1 -000 -000 -000 -000 -uuu -uuu lvrc 0101 0101 0101 0101 uuuu uuuu pa 1--1 1111 1--1 1111 u--u uuuu pac 1--1 1111 1--1 1111 u--u uuuu papu 0--0 0000 0--0 0000 u--u uuuu pawu 0--0 0000 0--0 0000 u--u uuuu wdtc 0101 0011 0101 0011 uuuu uuuu tbc --00 ---- --00 ---- --uu ---- t ? r 0000 0000 0000 0000 uuuu uuuu t ? rc --00 -000 --00 -000 --uu -uuu eea --11 1111 --11 1111 --uu uuuu eed 0000 0000 0000 0000 uuuu uuuu pb 1111 1111 1111 1111 uuuu uuuu pbc 1111 1111 1111 1111 uuuu uuuu pbpu 0000 0000 0000 0000 uuuu uuuu i ? ctoc 0000 0000 0000 0000 uuuu uuuu si ? c0 0000 -00- 0000 -00- uuuu -uu-
rev. 1.00 5? ?a? 0?? ?01? rev. 1.00 5 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu register lvr&power on wdt overfow (normal mode) wdt overfow (halt mode) si ? c1 0000 -000 0000 -000 uuuu -uuu si ? d 0000 0000 0000 0000 uuuu uuuu si ? c ? --11 1111 --11 1111 --uu uuuu si ? a 0000 0000 0000 0000 uuuu uuuu pc 1111 1111 1111 1111 uuuu uuuu pcc 1111 1111 1111 1111 uuuu uuuu pcpu 0000 0000 0000 0000 uuuu uuuu tkt ? r 0000 0000 0000 0000 uuuu uuuu tkc0 -000 0000 -000 0000 -uuu uuuu tk16dl 0000 0000 0000 0000 uuuu uuuu tk16dh 0000 0000 0000 0000 uuuu uuuu tkc1 ---- --11 ---- --11 ---- --uu tk ? 016dl 0000 0000 0000 0000 uuuu uuuu tk ? 016dh 0000 0000 0000 0000 uuuu uuuu tk ? 0rol 0000 0000 0000 0000 uuuu uuuu tk ? 0roh ---- --00 ---- --00 ---- --uu tk ? 0c0 0000 0000 0000 0000 uuuu uuuu tk ? 0c1 0-00 0000 0-00 0000 u-uu uuuu tk ? 116dl 0000 0000 0000 0000 uuuu uuuu tk ? 116dh 0000 0000 0000 0000 uuuu uuuu tk ? 1rol 0000 0000 0000 0000 uuuu uuuu tk ? 1roh ---- --00 ---- --00 ---- --uu tk ? 1c0 0000 0000 0000 0000 uuuu uuuu tk ? 1c1 0000 0000 0000 0000 uuuu uuuu tk ?? 16dl 0000 0000 0000 0000 uuuu uuuu tk ?? 16dh 0000 0000 0000 0000 uuuu uuuu tk ?? rol 0000 0000 0000 0000 uuuu uuuu tk ?? roh ---- --00 ---- --00 ---- --uu tk ?? c0 0000 0000 0000 0000 uuuu uuuu tk ?? c1 0000 0000 0000 0000 uuuu uuuu eec ---- 0000 ---- 0000 ---- uuuu note: - not implement u stands for unchanged x stands for unknown
rev. 1.00 54 ? a ? 0 ?? ? 01 ? rev. 1.00 55 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bs83b16a-3/BS83B16A-4 register register lvr&power on wdt overfow (normal mode) wdt overfow (halt mode) iar0 ---- ---- ---- ---- ---- ---- ? p0 xxxx xxxx xxxx xxxx uuuu uuuu iar1 ---- ---- ---- ---- ---- ---- ? p1 xxxx xxxx xxxx xxxx uuuu uuuu bp ---- ---0 ---- ---0 ---- ---u acc xxxx xxxx uuuu uuuu uuuu uuuu pcl 0000 0000 0000 0000 0000 0000 tblp xxxx xxxx uuuu uuuu uuuu uuuu tblh xxxx xxxx uuuu uuuu uuuu uuuu tbhp ---- xxxx ---- uuuu ---- uuuu status --00 xxxx --1u uuuu --11 uuuu s ? od 0000 0011 0000 0011 uuuu uuuu ctrl 0-00 -x00 0-00 -x00 u-uu -uuu integ ---- --00 ---- --00 ---- --uu intc0 -000 0000 -000 0000 -uuu uuuu intc1 -000 -000 -000 -000 -uuu -uuu lvrc 0101 0101 0101 0101 uuuu uuuu pa 1--1 1111 1--1 1111 u--u uuuu pac 1--1 1111 1--1 1111 u--u uuuu papu 0--0 0000 0--0 0000 u--u uuuu pawu 0--0 0000 0--0 0000 u--u uuuu wdtc 0101 0011 0101 0011 uuuu uuuu tbc --00 ---- --00 ---- --uu ---- t ? r 0000 0000 0000 0000 uuuu uuuu t ? rc --00 -000 --00 -000 --uu -uuu eea --11 1111 --11 1111 --uu uuuu eed 0000 0000 0000 0000 uuuu uuuu pb 1111 1111 1111 1111 uuuu uuuu pbc 1111 1111 1111 1111 uuuu uuuu pbpu 0000 0000 0000 0000 uuuu uuuu i ? ctoc 0000 0000 0000 0000 uuuu uuuu si ? c0 0000 -00- 0000 -00- uuuu -uu- si ? c1 0000 -000 0000 -000 uuuu -uuu si ? d 0000 0000 0000 0000 uuuu uuuu si ? c ? --11 1111 --11 1111 --uu uuuu si ? a 0000 0000 0000 0000 uuuu uuuu pc 1111 1111 1111 1111 uuuu uuuu pcc 1111 1111 1111 1111 uuuu uuuu pcpu 0000 0000 0000 0000 uuuu uuuu tkt ? r 0000 0000 0000 0000 uuuu uuuu tkc0 -000 0000 -000 0000 -uuu uuuu tk16dl 0000 0000 0000 0000 uuuu uuuu tk16dh 0000 0000 0000 0000 uuuu uuuu tkc1 ---- --11 ---- --11 ---- --uu tk ? 016dl 0000 0000 0000 0000 uuuu uuuu tk ? 016dh 0000 0000 0000 0000 uuuu uuuu
rev. 1.00 54 ?a? 0?? ?01? rev. 1.00 55 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu register lvr&power on wdt overfow (normal mode) wdt overfow (halt mode) tk ? 0rol 0000 0000 0000 0000 uuuu uuuu tk ? 0roh ---- --00 ---- --00 ---- --uu tk ? 0c0 0000 0000 0000 0000 uuuu uuuu tk ? 0c1 0-00 0000 0-00 0000 u-uu uuuu tk ? 116dl 0000 0000 0000 0000 uuuu uuuu tk ? 116dh 0000 0000 0000 0000 uuuu uuuu tk ? 1rol 0000 0000 0000 0000 uuuu uuuu tk ? 1roh ---- --00 ---- --00 ---- --uu tk ? 1c0 0000 0000 0000 0000 uuuu uuuu tk ? 1c1 0000 0000 0000 0000 uuuu uuuu tk ?? 16dl 0000 0000 0000 0000 uuuu uuuu tk ?? 16dh 0000 0000 0000 0000 uuuu uuuu tk ?? rol 0000 0000 0000 0000 uuuu uuuu tk ?? roh ---- --00 ---- --00 ---- --uu tk ?? c0 0000 0000 0000 0000 uuuu uuuu tk ?? c1 0000 0000 0000 0000 uuuu uuuu tk ?? 16dl 0000 0000 0000 0000 uuuu uuuu tk ?? 16dh 0000 0000 0000 0000 uuuu uuuu tk ?? rol 0000 0000 0000 0000 uuuu uuuu tk ?? roh ---- --00 ---- --00 ---- --uu tk ?? c0 0000 0000 0000 0000 uuuu uuuu tk ?? c1 0000 0000 0000 0000 uuuu uuuu eec ---- 0000 ---- 0000 ---- uuuu note: - not implement u stands for unchanged x stands for unknown
rev. 1.00 56 ? a ? 0 ?? ? 01 ? rev. 1.00 57 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu input/output ports holtek m icrocontrollers of fer c onsiderable fe xibility on t heir i/ o port s. w ith t he i nput or out put designation of every pin fully under user program control, pull-high selections for all ports and wake-up selections on certain pins, the user is provided with an i/o structure to meet the needs of a wide range of application possibilities. the device provides bidirectional input/output lines labeled with port names p a~p c . these i/o ports are mapped to the ram data memory with specifc addresses as shown in the special purpose data memory table. a ll of thes e i/o ports can be used for input and output operations. for input operation, these ports are non-latch ing, which means the inputs must be ready at the t2 rising edge of instruction mov a, [m], where m denotes the port address. for output operation, all the data is latched and remains unchanged until the output latch is rewritten. i/o register list bs83b08a-3/bs83b08a-4 register name bit 7 6 5 4 3 2 1 0 pawu d7 d4 d ? d ? d1 d0 papu d7 d4 d ? d ? d1 d0 pa d7 d4 d ? d ? d1 d0 pac d7 d4 d ? d ? d1 d0 pbpu d7 d6 d5 d4 d ? d ? d1 d0 pb d7 d6 d5 d4 d ? d ? d1 d0 pbc d7 d6 d5 d4 d ? d ? d1 d0 bs83b12a-3/bs83b12a-4 register name bit 7 6 5 4 3 2 1 0 pawu d7 d4 d ? d ? d1 d0 papu d7 d4 d ? d ? d1 d0 pa d7 d4 d ? d ? d1 d0 pac d7 d4 d ? d ? d1 d0 pbpu d7 d6 d5 d4 d ? d ? d1 d0 pb d7 d6 d5 d4 d ? d ? d1 d0 pbc d7 d6 d5 d4 d ? d ? d1 d0 pcpu d ? d ? d1 d0 pc d ? d ? d1 d0 pcc d ? d ? d1 d0
rev. 1.00 56 ?a? 0?? ?01? rev. 1.00 57 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bs83b16a-3/BS83B16A-4 register name bit 7 6 5 4 3 2 1 0 pawu d7 d4 d ? d ? d1 d0 papu d7 d4 d ? d ? d1 d0 pa d7 d4 d ? d ? d1 d0 pac d7 d4 d ? d ? d1 d0 pbpu d7 d6 d5 d4 d ? d ? d1 d0 pb d7 d6 d5 d4 d ? d ? d1 d0 pbc d7 d6 d5 d4 d ? d ? d1 d0 pcpu d7 d6 d5 d4 d ? d ? d1 d0 pc d7 d6 d5 d4 d ? d ? d1 d0 pcc d7 d6 d5 d4 d ? d ? d1 d0 pull-high resistors many product applications require pull-high resistors for their switch inputs usually requiring the use of an external resistor . t o eliminate the need for these external resistors, all i/o pins, when confgured as an input have the capability of being connected to an internal pull-high resistor . these pull-high resistors are selected using registers p apu~p c pu, and are implemented using weak pmos transistors. papu register bit 7 6 5 4 3 2 1 0 name d7 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7 i/o port a bit 7 pull-high control 0: disable 1: enable bit 6~5 unimplemented, read as 0 bit 4~0 i/o port a bit 4~bit 0 pull-high control 0: disable 1: enable pbpu register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~0 i/o port b bit 7~bit 0 pull-high control 0: disable 1: enable
rev. 1.00 58 ? a ? 0 ?? ? 01 ? rev. 1.00 59 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu pcpu register C bs83b12a-3/bs83b12a-4 bit 7 6 5 4 3 2 1 0 name d ? d ? d1 d0 r/w r/w r/w r/w r/w por 0 0 0 0 bit 7~4 unimplemented, read as 0 bit 3~0 i/o port c bit 3~bit 0 pull-high control 0: disable 1: enable pcpu register C bs83b16a-3/BS83B16A-4 bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~0 i/o port c bit 7~bit 0 pull-high control 0: disable 1: enable port a wake-up the hal t instruction forces the microcontroller into the sleep or idle mode which preserves power, a feature that is important for battery and other low-power applications. v arious methods exist to wake-up the microcontroller, one of which is to change the logic condition on one of the port a pins from high to low . this function is especially suitable for applications that can be woken up via extern al switches. each pin on port a can be selected individually to have this wake-up feature using the pawu register. pawu register bit 7 6 5 4 3 2 1 0 name d7 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7 i/o port a bit 7 pull-high control 0: disable 1: enable bit 6~5 unimplemented, read as 0 bit 4~0 i/o port a bit 4~bit 0 w ake up control 0: disable 1: enable
rev. 1.00 58 ?a? 0?? ?01? rev. 1.00 59 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i/o port control registers each i/o port has its own control register known as p ac~p c c, to control the input/output configuration. w ith this control register , each cmos output or input can be reconfigured dynamically under software control. each pin of the i/o ports is directly mapped to a bit in its associated port control register . for the i/o pin to function as an input, the corresponding bit of the control register must be written as a 1. this will then allow the logic state of the input pin to be directly read by instructions. when the corresponding bit of the control register is written as a 0, the i/o pin will be setup as a cmos output. if the pin is currently setup as an output, instructions can still be used to read the output register . however, it should be noted that the program will in fact only read the status of the output data latch and not the actual logic status of the output pin. pac register bit 7 6 5 4 3 2 1 0 name d7 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 bit 7 i/o port a bit 7 input/output control 0: disable 1: enable bit 6~5 unimplemented, read as 0 bit 4~0 i/o port a bit 4~bit 0 input/output control 0: disable 1: enable pbc register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 1 1 bit 7~0 i/o port b bit 7~bit 0 input/output control 0: output 1: input pcc register C bs83b12a-3/bs83b12a-4 bit 7 6 5 4 3 2 1 0 name d ? d ? d1 d0 r/w r/w r/w r/w r/w por 1 1 1 1 bit 7~4 unimplemented, read as 0 bit 3~0 i/o port c bit 3~bit 0 input/output control 0: disable 1: enable
rev. 1.00 60 ? a ? 0 ?? ? 01 ? rev. 1.00 61 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu pcc register C bs83b16a-3/BS83B16A-4 bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 1 1 bit 7~0 i/o port c bit 7~bit 0 input/output control 0: disable 1: enable i/o pin structures the accompanying diagrams illustrate the internal structures of some generic i/o pin types. as the exact logical construction of the i/o pin will dif fer from these drawings, they are supplied as a guide only to assist with the functional understanding of the i/o pins. the wide range of pin-shared structures does not permit all types to be shown. generic input/output structure programming considerations within the user program, one of the frst things to consider is port initi alisation. after a reset, all of the i/o data and port control registers will be set high. this means that all i/o pins will default to an i nput st ate, t he l evel of whi ch de pends on t he ot her c onnected c ircuitry a nd whe ther pul l-high selections have been chosen. if the port control registers, p ac~p c c, are then programmed to setup some pins as outputs, these output pins will have an initial high output value unless the associated port data registers, p a~p c , are frst programmed. selecting which pins are inputs and which are outputs can be achieved byte-wide by loading the correct values into the appropriate port control register o r b y p rogramming individual b its i n t he p ort c ontrol r egister u sing t he set [ m].i a nd clr [m ].i i nstructions. not e t hat when usi ng t hese bi t c ontrol i nstructions, a re ad-modify-write operation takes place. the microcontroller must frst read in the data on the entire port, modify it to the required new bit values and then rewrite this data back to the output ports. port a has the additional capability of providing wake-up functions. when the device is in the sleep or idle mode, various methods are available to wake the device up. one of these is a high to low transition of any of the port a pins. single or multiple pins on port a can be setup to have this function.
rev. 1.00 60 ?a? 0?? ?01? rev. 1.00 61 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu timer/event counter the provision of timers form an important part of any microcontroller , giving the designer a means of carrying out time related functions. the devices contain one 8-bit. the provision of an internal prescaler to the clock circuitry on gives added range to the timer. there are two types of registers related to the t imer/event counters. the frst is the register that contains the actual value of the timer and into which an initial value can be preloaded. reading from this register retrieves the contents of the t imer/event counter. the second type of associated register is the t imer control register which defnes the timer options. timer/event counter confguring the timer/event counter input clock source the t imer/event count er c lock sourc e c an ori ginate from e ither t he syst em c lock f sys or t he f sub oscillator, the choice of which is determined by the ts bit in the tmrc register . this internal clock source is frst divided by a prescaler , the division ratio of which is conditioned by the t imer control register bits tpsc0~tpsc2. timer register C tmr the time r register is a special function register located in the special purpose data memory and is the place where the actual timer value is stored, it is known as tmr. the value in the timer register increases by one each time an inter nal clock pulse is received the tim er will count from the initial value loaded by the preload register to the full count of ffh at which point the timer overfows and an internal inte rrupt signal is generated. the timer value will then be reset with the init ial preload register value and continue counting. note that to achie ve a maximum full range count of ffh, the preload register must frst be cleared to all z eros. i t sh ould b e n oted t hat a fter p ower-on, t he p reload r egisters wi ll b e i n a n u nknown condition. note that if the t imer/event counter is in an off condition and data is written to its preload register , this data will be immediately written into the actual counter . however , if the counter is enabled and counting, any new data written into the preload data register during this period will remain in the preload register and will only be written into the actual counter the next time an overfow occurs.
rev. 1.00 6 ? ? a ? 0 ?? ? 01 ? rev. 1.00 6? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu timer control register C tmrc the t imer control register is known as tmrc. it is the t imer control register together with the corresponding t imer r egister t hat c ontrol t he f ull o peration o f t he t imer/event c ounter. b efore the timer c an b e u sed, i t i s e ssential t hat t he t imer c ontrol r egister i s fu lly p rogrammed wi th t he right data to ensure its correct operation, a process that is normally carried out during program initialisation. the timer -on bit, which is bit 4 of the t imer control register and known as t on, provides the basic on/off control of the timer . setting the bit high allows the counter to run, clearing the bit stops the counter. bits 0~2 of the t imer control register determine the division ratio of the input clock prescaler. the ts bit selects the internal clock source . tmrc register bit 7 6 5 4 3 2 1 0 name ts ton tpsc ? tpsc1 tpsc0 r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 bit 7~6 unimplemented, read as "0" bit 5 ts: t imer/event counter clock source 0: f sys 1: f sub bit 4 ton: t imer/event counter counting enable 0: disable 1: enable bit 3 unimplemented, read as "0" bits 2~0 tpsc2~tpsc0: t imer prescaler rate selection timer internal clock= 000 : 001 : /2 010 : /4 011 : /8 100 : /16 101 : /32 110 : /64 111 : /128 timer operation the t imer/event counter is utilised to measure fxed time intervals, providing an internal interrupt signal e ach t ime t he t imer/event count er ove rflows. t he t imer i nput c lock sourc e i s e ither f sys or f sub , however, this timer clock source is further divided by a prescaler , the value of which is determined by the bits tpsc2~tpsc0 in the t imer control register . the timer -on bit, t on must be set high to enable the timer to run. each time an internal clock transition occurs, the timer increments by one; when the timer is full and overfows, an interrupt signal is generated and the timer will reload the value already loaded into the preload register and continue counting. a timer overfow condition and corresponding internal interrupt is one of the wake-up sources, however , the internal i nterrupts c an be disabled by e nsuring t hat t he t imer e nable bi t i n t he i nterrupt re gister i s reset to zero .
rev. 1.00 6? ?a? 0?? ?01? rev. 1.00 6 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu prescaler bits t psc0~tpsc2 of t he t mrc re gister c an be use d t o de fine a di vision ra tio for t he i nternal clock source of the t imer/event counter enabling longer time out periods to be setup. programming considerations when t he t imer/event c ounter i s r ead, o r i f d ata i s wr itten t o t he p reload r egister, t he c lock i s inhibited to avoid errors, however as this may result in a counting error , this should be taken into account by the programmer. care must be taken to ensure that the timer is properly initialised before using it for the frst time. the associated timer enable bits in the interrupt control register must be properly set otherwise the internal interrupt associated with the timer will remain inactive. it is also important to ensure that an initial value is frst loaded into the timer registers before the timer is switched on; this is because after power-on the initial values of the timer registers are unknown. after the timer has been initialized the timer can be turned on and of f by controlling the enable bit in the timer control regis ter. when the t imer/event counter overf ows, its corres ponding interrupt request flag in the interrupt control register will be set. if the t imer/event counter interrupt is enabled this will in turn generate an interrupt signal. however irrespective of whether the interrupts are enabl ed or not, a t imer/event counter overfow will also generate a wake-up signal if the device is in a power-down condition. t o prevent such a wake-up from occurring, the timer interrupt request fag should frst be set high before issuing the halt instruction to enter the idle/sleep mode. touch key function each device provides multiple touch key functions. the touch key function is fully integrated and requires no external components, allowing touch key functions to be implemented by the simple manipulation of internal registers. touch key structure the touch keys are pin shared with the pb and pc logic i/o pins, with the desired function chosen via register bits. keys are or ganised into groups of four , with each group known as a module and having a module number , m0 to m3. each module is a fully independent set of four t ouch keys and each t ouch key has its own oscillator . each module contains its own control logic circuits and register set. examination of the register names will reveal the module number it is referring to. device keys - n touch key module touch key shared i/o pin bs8 ? b08a- ? /bs8 ? b08a-4 8 ? 0 k1~k4 pb0~pb ? ? 1 k5~k8 pb4~pb7 bs8 ? b1 ? a- ? /bs8 ? b1 ? a-4 1 ? ? 0 k1~k4 pb0~pb ? ? 1 k5~k8 pb4~pb7 ?? k9~k1 ? pc0~pc ? bs8 ? b16a- ? /bs8 ? b16a-4 16 ? 0 k1~k4 pb0~pb ? ? 1 k5~k8 pb4~pb7 ?? k9~k1 ? pc0~pc ? ?? k1 ? ~k16 pc4~pc7
rev. 1.00 64 ? a ? 0 ?? ? 01 ? rev. 1.00 65 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu touch key register defnition each t ouch k ey m odule, wh ich c ontains f our t ouch k ey f unctions, h as i ts o wn su ite r egisters. t he following table shows the register set for each touch key module. the mn within the register name refers t o t he t ouch ke y m odule num ber , bs83b08a-3/bs83b08a-4 ha s a ra nge of m0 t o m 1, bs83b12a-3/bs83b12a-4 has a range of m0 to m 2, bs83b16a-3/BS83B16A-4 has a range of m0 to m 3. name usage tkt ? r touch ke ? 8-bit timer/counter register tkc0 counter on-off and clear control/reference clock control/start bit tk16dl touch ke ? module 16-bit counter low b ? te contents tk16dh touch ke ? module 16-bit counter high b ? te contents tkc1 touch ke ? osc frequenc ? select tk ? n16dl ? odule n 16-bit counter low b ? te contents tk ? n16dh ? odule n 16-bit counter high b ? te contents tk ? nrol reference osc internal capacitor select tk ? nroh reference osc internal capacitor select tk ? nc0 control register 0 ? ultiplexer ke ? select tk ? nc1 control register 1 ke ? oscillator control/reference oscillator control/touch ke ? or i/o select register listing register name bit 7 6 5 4 3 2 1 0 tkt ? r d7 d6 d5 d4 d ? d ? d1 d0 tkc0 tkrcov tkst tkcfov tk16ov tscs tk16s1 tk16s0 tk16dl d7 d6 d5 d4 d ? d ? d1 d0 tk16dh d7 d6 d5 d4 d ? d ? d1 d0 tkc1 tkfs1 tkfs0 tk ? n16dl d7 d6 d5 d4 d ? d ? d1 d0 tk ? n16dh d7 d6 d5 d4 d ? d ? d1 d0 tk ? nrol d7 d6 d5 d4 d ? d ? d1 d0 tk ? nroh d9 d8 tk ? nc0 ? n ? xs1 ? n ? xs0 ? ndfen ? nfilen ? nsofc ? nsof ? ? nsof1 ? nsof0 tk ? nc1 ? ntss ? nroen ? nkoen ? nk4io ? nk ? io ? nk ? io ? nk1io touch key module (n=0~3) tktmr register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~0 touch key 8-bit timer/counter register time slot counter overfow set-up time is (256-tktmr[7:0]) 32
rev. 1.00 64 ?a? 0?? ?01? rev. 1.00 65 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu tkc0 register bit 7 6 5 4 3 2 1 0 name tkrcov tkst tkcfov tk16ov tscs tk16s1 tk16s0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 bit 7 unimplemented, read as "0" bit 6 tkrcov: t ime slot counter overfow fag 0: no overfow 1: overfow if m odule 0 or al l m odule (se lect by t scs bi t) t ime sl ot c ounter i s ove rflow, t he touch key interrupt request fag will be set (tkmf) and all module key osc and ref osc auto stop. all module 16-bit c/f counter , 16-bit counter , 5-bit tim e slot counter and 8-bit time slot timer counter will be automatically off. bit 5 tkst: start t ouch key detection control bit 0: stopped 01: started in all modules the16-bit c/f counter , 16-bit counter , 5-bit time slot counter will be a utomatically c leared whe n t his bi t i s c leared t o 0 (8-bi t progra mmable t ime slot counter will not be cleared, which overflow time is setup by user). when this bit changes from low to high, the 16-bit c/f counter , 16-bit counter , 5-bit time slot counter and 8-bit time slot timer counter will be automatically on and enable key osc and ref osc output clock input these counter. bit 4 tkcfov: t ouch key module 16-bit c/f counter overfow fag 0: not overfow 1: overfow this bit must be cleared by software. bit 3 tk16ov: t ouch key module 16-bit counter overfow fag 0: not overfow 1: overfow this bit must be cleared by software. bit 2 tscs: t ouch key time slot counter select 0: each module use own time slot counter. 1: all t ouch key module use module 0 time slot counter. bit 1~0 tk16s1~tk16s0: the touch key module 16-bit counter clock source select 00: f sys 01: f sys /2 10: f sys /4 11: f sys /8 tkc1 register bit 7 6 5 4 3 2 1 0 name tkfs1 tkfs0 r/w r/w r/w por 1 1 bit 7 ~2 unimplemented, read as "0" bit 1~0 tkfs1~tkfs0: t ouch key osc frequency select 00 : 500khz 01 : 1000khz 10: 1500khz 1 1 : 2000khz
rev. 1.00 66 ? a ? 0 ?? ? 01 ? rev. 1.00 67 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu tk16dl register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 touch key module 16-bit counter low byte contents tk16dh register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 touch key module 16-bit counter high byte contents tkmn16dl register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 module n 16-bit counter low byte contents tkmn16dh register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 module n 16-bit counter high byte contents tkmnrol register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~0 reference osc inernal capacitor select osc inernal capacitor select : (tkmnro[9:0] 50pf)/1024 tkmnroh register bit 7 6 5 4 3 2 1 0 name d9 d8 r/w r/w r/w por 0 0 bit 7 ~2 unimplemented, read as "0" bit 1~0 reference osc inernal capacitor select osc inernal capacitor select : (tkmnro[9:0] 50pf)/1024
rev. 1.00 66 ?a? 0?? ?01? rev. 1.00 67 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu tkmnc0 register bit 7 6 5 4 3 2 1 0 name ? n ? xs1 ? n ? xs0 ? ndfen ? nfilen ? nsofc ? nsof ? ? nsof1 ? nsof0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 ~6 mnmxs1~mnmxs0: multiplexer key select bit 5 mndfen: multi-frequency control 0: disable 1: enable bit 4 mnfilen: filter function control 0: disable 1: enable bit3 mnsofc: c to f osc frequency hopping function control 0: the frequency hopping function is controlled by mnsof2~ mnsof0 bits 1: the frequency hopping function is controlled by hardware regardless of what is the state of mnsof2~ mnsof0 bits bit 2~0 mnsof2~ mnsof0: selecting key osc and ref osc frequency as c to f osc is controlled by software 000: 1380khz 001: 1500khz 010: 1670khz 011: 1830khz 100: 2000khz 101: 2230khz 110: 2460khz 111: 2740khz the frequency which is mentioned here willl be changed when the exte rnal or internal capacitor is with dif ferent value. if the touch key operates at a frequency of 2mhz, users can adjust the frequency in scale when select other frequency.
rev. 1.00 68 ? a ? 0 ?? ? 01 ? rev. 1.00 69 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu tkmnc1 register bit 7 6 5 4 3 2 1 0 name ? ntss ? nroen ? nkoen ? nk4io ? nk ? io ? nk ? io ? nk1io r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 bit 7 mntss: t imer slot counter clock select 0: ref oscillator 1: f sys /4 bit 6 unimplemented, read as "0" bit 5 mnroen: reference osc control 0: disable 1: enable bit 4 mnkoen: key osc control 0: disable 1: enable bit 3~0 mnk4io~mnk1io: i/o pin or touch key function select mnk4oen m0 m1 m2 m3 pb3/key4 pb7/key8 pc3/key12 pc7/key16 0 i/o 1 touch ke ? mnk3oen m0 m1 m2 m3 pb2/key3 pb6/key7 pc2/key11 pc6/key15 0 i/o 1 touch ke ? mnk2oen m0 m1 m2 m3 pb1/key2 pb5/key6 pc1/key10 pc5/key14 0 i/o 1 touch ke ? mnk1oen m0 m1 m2 m3 pb0/key1 pb4/key5 pc0/key9 pc4/key13 0 i/o 1 touch ke ? input
rev. 1.00 68 ?a? 0?? ?01? rev. 1.00 69 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu touch key operation when a fnge r t ouches or i s i n proxi mity t o a t ouch pa d, t he c apacitance of t he pa d wi ll i ncrease. by using this capa citance variation to change slightly the frequency of the internal sense oscillator , touch actions can be sensed by mea suring these frequency changes. using an internal programmable divider the reference clock is used to generate a fixed time period. by counting a number of generated clock cycles from the sense oscillator during this fxed time period touch key actions can be determined. during this reference clock fixed interval, the number of clock cycles generated by the s ense oscillator is measured, and it is this value that is used to determine if a touch action has been made or not.th ese devic e s contain four touch key inputs which are shared with logical i/o pins, with the desired function selected using register bits. using the tscs bit in the tkc0 register can select the module 0 time slot counter as the time slot counter for a ll m odules. al l m odules use t he sa me st arted si gnal. t he 16-bit c/ f c ounter, 16- bit counter, 5-bit time slot counter in all module s will be automatically cleared when this bit is cleared to "0" , but the 8-bit programmable time slot counter will not be cleared. the overfow time is setup by user . when this bit changes from low to high , the 16-bit c/f counter , 16-bit counter , 5-bit time slot counter and 8-bit time slot timer counter will be automatically switched on. the key oscillator and reference oscillator in all modules will be automatically stopped and the 16-bit c/f counte r, 16-bit counter , 5-bit time slot counter and 8-bit time slot timer counter will be automatically switched of f when the 5-bit time slot counter overfows. the clock source for the time slot c ounter and 8+5 bi t count er, i s sourc ed from t he refe rence osc illator or f sys /4. the refe rence oscillator and key oscillator will be enabled by setting the mnroen bit and mnkoen bits in the tkmnc1 register . w hen the time s lot counter in all the touch key modules or in the touch key module 0 overfow s, a n actual t ouch k ey interrupt will take place . the touch keys mentioned here are the keys which are enabled. each touch key module, which consists of four touch keys , key 1~key 4 is contained in module 0, key 5~key 8 is contained in module 1, key 9~key 12 is contained in module 2 and key 13~key 16 is contained in the module 3. each touch key module has an identical structure.
rev. 1.00 70 ? a ? 0 ?? ? 01 ? rev. 1.00 71 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu key 1 key ? key ? key 4 key osc key osc key osc key osc ?ux . filter overflow 16- bit counter overflow f sys ?f sys /??f sys /4?f sys /8 tk 16 s1~ tk 16 s0 5- bit time slot counter overflow 8- bit time slot timer counter ref osc ?ux . f sys /4 ?ntss 8- bit time slot timer counter preload register overflow ?ulti - frequenc? 16- bit c / f counter note: each touch key module contains the content in the dash line. touch switch module block diagram
rev. 1.00 70 ?a? 0?? ?01? rev. 1.00 71 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu the touch key sense oscilltor and reference oscillator timing diagram is shown in the following fgure: tkst enck ....... ....... ....... ....... f tmck (dfen=0) f tmck (dfen=1) time slot counter overflow flag set touch key interrupt request flag hardware set to ?0? tstmr overflow * 32 f ref key osc en key osc clk rey osc en touch key or i/o function select
rev. 1.00 7 ? ? a ? 0 ?? ? 01 ? rev. 1.00 7? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu touch key interrupt the touch key only has single inter rupt, w hen the time slot counter in all the touch key modules or in t he t ouch ke y m odule 0 ove rfow s, a n a ctual t ouch k ey i nterrupt wi ll t ake pl ace . t he 16-bit c/f counter, 1 6-bit c ounter, 5 -bit t ime sl ot c ounter and 8 -bit t ime sl ot c ounter i n a ll m odule s wi ll b e automatically cleared. the tkcfov flag, which is the 16-bit c/f counter overflow flag will go high when a ny of the touch k ey m odule 16-bit c /f counter overf ow s. as this f ag w ill not be automatically cleared, it has to be cleared by the application program. module 0 o nly contains one 16-bit counter . the tk16ov fag, which is the 16-bit counter overfow fag will go high when the 16-bit counter overfow s. as this fag will not be automatically cleared, it has to be cleared by the appl ication program. more details regarding the touch key interrupt is located in the interrupt section of the datasheet. programming considerations after t he rel evant regi sters are se tup, t he t ouch key det ection process i s i nitiated t he cha nging t he tk st bit from low to high. this will enable and synchronise all relevant oscillators. the tkrcov fag, whi ch i s t he t ime sl ot c ounter fa g wi ll go hi gh a nd re main hi gh unt il t he c ounter ove rfows. when this happens an interrupt signal will be generated. when the external touch key size and layout are defined, their related capacitances will then determine the sensor oscillator frequency. serial interface module C sim these device s contain a serial interface module, which include both the four line spi interface and the two line i 2 c interface types, to allow an easy method of communication with external peripheral hardware. having relatively simple communication protocols, these serial interface types allow the microcontroller to interface to external spi or i 2 c based hardware such as sensors, flash memory or eeprom memory , etc. the sim interface pins are pin-shared with other i/o pins and must be selected using the simen bit in the simc0 register . as both interface types share the same pins and registers, the choice of whether the spi or i 2 c type is used is made using the sim operating mode control bits, named sim2~sim0, in the simc0 register. spi interface the spi interface is often used to communicate with external peripheral devices such as sensors, flash or eeprom memory devices etc. originally developed by motorola, the four line spi interface is a synchronous serial data interface that has a relatively simple communication protocol simplifying the programming requirements when communicating with external hardware devices. the communication is full duplex and operates as a slave/master type, where the device can be either master or s lave. a lthough the s pi interface s pecifcation can control multiple s lave devices from a single master , but this device provided only one scs pin. if the mas ter needs to control multiple slave devices from a single master, the master can use i/o pin to select the slave devices.
rev. 1.00 7? ?a? 0?? ?01? rev. 1.00 7 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu spi interface operation the spi i nterface i s a f ull d uplex sy nchronous se rial d ata l ink. i t i s a f our l ine i nterface wi th p in names sdi, sdo, sck and scs . pins sdi and sdo are the serial data input and serial data output lines, sck is the serial clock line and scs is the slave select line. as the spi interface pins are pin-shared with normal i/o pins and with the i 2 c function pins, the spi interface must frst be enabled by setting the correct bits in the simc0 and simc2 registers. communication between devices connected to the spi interface is carried out in a slave/master mode with all data transfer initiations b eing i mplemented by t he m aster. t he ma ster a lso c ontrols t he c lock si gnal. as t he d evice only contains a single scs pin only one slave device can be utilized. the scs pin is controlled by software, set csen bit to "1" to enable scs pin function, set csen bit to " 0 " the scs pin will be as i/o function. spi master/slave connection spi block diagram the spi function in this device offers the following features: ? full duplex synchronous data transfer ? both master and slave modes ? lsb frst or msb frst data transmission modes ? transmission complete fag ? rising or falling active clock edge the status of the spi interface pins is determined by a number of facto rs such as whether the device is in the master or slave mode and upon the condition of certain control bits such as csen and simen.
rev. 1.00 74 ? a ? 0 ?? ? 01 ? rev. 1.00 75 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu spi registers there are three internal registers which control the overall operation of the spi interface. these are the simd data register and two registers simc0 and simc2. note that the simc1 register is only used by the i 2 c interface. register name bit 7 6 5 4 3 2 1 0 si ? c0 si ?? si ? 1 si ? 0 si ? en si ? d d7 d6 d5 d4 d ? d ? d1 d0 si ? c ? ckpolb ckeg ? ls csen wcol trf sim registers list the simd register is used to store the data being transmitted and received. the same register is used by both the spi and i 2 c functions. before the device writes data to the spi bus, the actual data to be transmitted must be placed in the simd register . after the data is received from the spi bus, the device can read it from the simd register . any transmission or reception of data from the spi bus must be made via the simd register. simd register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por x x x x x x x x x unknown there are also two control registers for the spi interface, simc0 and simc2. note that the simc2 register also has the name sima which is used by the i 2 c function. the simc1 register is not used by the spi functio n, only by the i 2 c function. register simc0 is used to control the enable/disable function a nd t o se t t he da ta t ransmission c lock fre quency. al though not c onnected wi th t he spi function, the simc0 register is also used to control the peripheral clock prescaler . register simc2 is used for other control functions such as lsb/msb selection, write collision fag etc.
rev. 1.00 74 ?a? 0?? ?01? rev. 1.00 75 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu simc0 register bit 7 6 5 4 3 2 1 0 name si ?? si ? 1 si ? 0 si ? en r/w r/w r/w r/w r/w por 1 1 1 0 bit 7~5 sim2~sim0: sim operating mode control 000: spi master mode; spi clock is f sys /4 001: spi master mode; spi clock is f sys /16 010: spi master mode; spi clock is f sys /64 011: spi master mode; spi clock is f sub 100: spi master mode; spi clock is tm r frequency/2 101: spi slave mode 110: i 2 c slave mode 111: unused mode these bits setup the overall operatin g mode of the sim function. as well as selecting if the i 2 c or spi function, they are used to control the spi master/slav e selection and the spi master clock frequency . the spi clock is a function of the system clock but can also be chosen to be sourced from the timer/event counter . if the spi slave mode is selected then the clock will be supplied by an external master device. bit 4~2 unimplemented, read as "0" bit 1 simen: sim control 0: disable 1: enable the bi t is the overa ll on/of f control for the sim interface. whe n the simen bi t is cleared to zero to disable the sim interface, the sdi, sdo, sck and scs , or sda and scl lines will be as i/o function and the sim operating current will be reduced to a minimum value. if the sim is confgured to operate as an spi interface via the sim2~sim0 bits, the contents of the spi control registers will remain at the previous settings when the simen bit changes from low to high and should therefore be frst initialised by the application program. if the sim is confgured to operate as an i 2 c interface via the sim2~sim0 bits and the simen bit changes from low tohigh, the contents of t he i 2 c c ontrol bi ts such a s ht x a nd t xak wi ll re main a t t he pre vious settings and should therefore be frst initialised by the application program while the relevant i 2 c flags s uch as h cf, h aas, h bb, s rw and rx ak w ill be s et to their default states. bit 0 unimplemented, read as "0"
rev. 1.00 76 ? a ? 0 ?? ? 01 ? rev. 1.00 77 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu simc2 register bit 7 6 5 4 3 2 1 0 name ckpolb ckeg ? ls csen wcol trf r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7~6 unimplemented, read as "0" bit 5 ckpolb: determines the base condition of the clock line 0: the sck line will be high when the clock is inactive 1: the sck line will be low when the clock is inactive the ckpolb bi t determines the ba se condition of the clock line, if the bi t is hi gh, then t he sck line wi ll be l ow whe n t he c lock i s i nactive. w hen t he ckpol b bi t i s low, then the sck line will be high when the clock is inactive. bit 4 ckeg: determines spi sck active clock edge type ckpolb=0 0: sck is high base level and data capture at sck rising edge 1: sck is high base level and data capture at sck falling edge ckpolb=1 0: sck is low base level and data capture at sck falling edge 1: sck is low base level and data capture at sck rising edge the ckeg and ckpolb bits are used to setup the way that the clock signal outputs and inputs data on the spi bus. these two bits must be confgured before data transfer is e xecuted ot herwise a n e rroneous c lock e dge m ay be ge nerated. t he ckpol b bi t determines t he ba se c ondition of t he c lock l ine, i f t he bi t i s hi gh, t hen t he sck l ine will be low when the clock is inact ive. when the ckpolb bit is low , then the sck line will be high when the clock is inactive. bit 3 mls: spi data shift order this is the data shift select bit and is used to select how the data is transferred, either msb or lsb frst. setting the bit high will select msb frst and low for lsb frst. bit 2 csen: spi scs pin control 0: disable 1: enable the csen bit is used as an enable/disable for the scs pin. if this bit is low , then the scs pin will be disabled and placed into a foating condition. if the bit is high the scs pin will be enabled and used as a select pin. bit 1 wcol: spi w rite collision fag 0: no collision 1: collision the wcol fag is used to detect if a data collision has occurred. if this bit is high it means that data has been attempted to be written to the simd register during a data transfer operation . this writing operation will be ignored if data is being transferred. the bit can be cleared by the application program. bit 0 trf: spi t ransmit/receive complete fag 0: data is being transferred 1: spi data transmission is completed the trf bit is the t ransmit/receive complete fag and is set 1 automatically when an spi data transmission is completed, but must set to 0 by the application program. it can be used to generate an interrupt.
rev. 1.00 76 ?a? 0?? ?01? rev. 1.00 77 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu spi communication after t he spi i nterface i s e nabled by se tting t he sime n bi t hi gh, t hen i n t he ma ster mode , whe n data is written to the simd register , transmission/reception will begin simultaneously . when the data t ransfer is c omplete, t he t rf fl ag wi ll be se t a utomatically, but m ust be c leared usi ng t he application program. in the slave mode, when the clock signal from the master has been received, any data in the simd register will be transmitted and any data on the sdi pin will be shifted into the simd register . the master should output an scs signal to enable the slave device before a clock signal is provided. the slave data to be transferred should be well prepared at the appropriate moment relative to the scs signal depending upon the confgurations of the ckpolb bit and ckeg bit. the accompanying timing diagram shows the relationship between the slave data and scs signal for various confgurations of the ckpolb and ckeg bits. the spi will continue to function even in the idle mode. spi master mode timing spi slave mode timing C ckeg=0
rev. 1.00 78 ? a ? 0 ?? ? 01 ? rev. 1.00 79 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu spi slave mode timing C ckeg=1 spi transfer control flowchart
rev. 1.00 78 ?a? 0?? ?01? rev. 1.00 79 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c interface the i 2 c interface is used to communicate with external peripheral devices such as sensors, eeprom memory e tc. or iginally d eveloped b y ph ilips, i t i s a t wo l ine l ow sp eed se rial i nterface for synchronous serial data transfer . the advantage of only two lines for communication, relatively simple communication protocol and the ability to accommodate multiple devices on the same bus has made it an extremely popular interface type for many applications. i 2 c master /slave bus connection i 2 c interface operation the i 2 c serial interface is a two line interf ace, a serial data line, sda, and serial clock line, scl. as many devices may be connected together on the same bus, their outputs are both open drain types. for this reason it is necessary that external pull-high resistors are connected to these outputs. note that no chip select line exists, as each device on the i 2 c bus is identifed by a unique address which will be transmitted and received on the i 2 c bus. when two device s communicate with each other on the bidirectional i 2 c bus, one is known as the master de vice a nd one a s t he sl ave de vice. bot h m aster a nd sl ave c an t ransmit a nd re ceive da ta, however, i t i s t he m aster de vice t hat ha s ove rall c ontrol of t he bus. for t h is de vice, wh ich onl y operates in slave mode, there are two methods of transferring data on the i 2 c bus, the slave transmit mode and the slave receive mode. the debounce tim e of the i 2 c interf ace uses the system clock to in ef fect add a debounce time to the external c lock t o re duce t he possi bility of gl itches on t he c lock l ine c ausing e rroneous ope ration. the debounce tim e, is 2 system clocks. t o achieve the required i 2 c data transfer speed, there exists a relationship between the system clock, f sys , and the i 2 c debounce tim e. for either the i 2 c standard or fast mode operation, users must take care of the selected system clock frequency and the confgured debounce time to match the criterion shown in the following table. i 2 c debounce time selection i 2 c standard mode (100khz) i 2 c fast mode (400khz) ? s ? stem clock debounce f sys > 4 ? hz f sys > 10 ? hz i 2 c minimum f sys frequency
rev. 1.00 80 ? a ? 0 ?? ? 01 ? rev. 1.00 81 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c registers there are four control registers associated with the i 2 c bus, simc0, simc1 , sima and i2ct oc and one data register , simd. the simd register , which is shown in the above spi section, is used to store the data being transmitted and received on the i 2 c bus. before the microcontroller writes data to the i 2 c bus, the actual data to be transmitted must be placed in the simd register . after the data is received from the i 2 c bus, the micro controller can read it from the simd register . any transmission or reception of data from the i 2 c bus must be made via the simd register . the sim pins are pin shared with other i/o pins and must be selected using the simen bit in the simc0 register . note that the sima register also has the name simc2 which is used by the spi function. bit simen and bits sim2~sim0 in register simc0 are used by the i 2 c interface. register name bit 7 6 5 4 3 2 1 0 si ? c0 si ?? si ? 1 si ? 0 si ? en si ? c1 hcf haas hbb htx txak srw rnic rxak si ? d d7 d6 d5 d4 d ? d ? d1 d0 si ? a a6 a5 a4 a ? a ? a1 a0 i ? ctoc i ? ctoen i ? ctof i ? ctos5 i ? ctos4 i ? ctos ? i ? ctos ? i ? ctos1 i ? ctos0 i 2 c registers list
rev. 1.00 80 ?a? 0?? ?01? rev. 1.00 81 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu simc0 register bit 7 6 5 4 3 2 1 0 name si ?? si ? 1 si ? 0 si ? en r/w r/w r/w r/w r/w por 1 1 1 0 bit 7~5 sim2~sim0: sim operating mode control 000: spi master mode; spi clock is f sys /4 001: spi master mode; spi clock is f sys /16 010: spi master mode; spi clock is f sys /64 011: spi master mode; spi clock is f sub 100: spi master mode; spi clock is tm r frequency/2 101: spi slave mode 110: i 2 c slave mode 111: unused mode these bits setup the overall operatin g mode of the sim function. as well as selecting if the i 2 c or spi function, they are used to control the spi master/slav e selection and the spi master clock frequency . the spi clock is a function of the system clock but can also be chosen to be sourced from the tm0. if the spi slave mode is selected then the clock will be supplied by an external master device. bit 4~2 unimplemented, read as "0" bit 1 simen: sim control 0: disable 1: enable the bi t is the overa ll on/of f control for the sim interface. whe n the simen bi t is cleared to zero to disable the sim interface, the sdi, sdo, sck and scs , or sda and scl lines will be as i/o function and the sim operating current will be reduced to a minimum value. if the sim is confgured to operate as an spi interface via the sim2~sim0 bits, the contents of the spi control registers will remain at the previous settings when the simen bit changes from low to high and should therefore be frst initialised by the application program. if the sim is confgured to operate as an i 2 c interface via the sim2~sim0 bits and the simen bit changes from low tohigh, the contents of t he i 2 c c ontrol bi ts such a s ht x a nd t xak wi ll re main a t t he pre vious settings and should therefore be frst initialised by the application program while the relevant i 2 c flags s uch as h cf, h aas, h bb, s rw and rx ak w ill be s et to their default states. bit 0 unimplemented, read as "0"
rev. 1.00 8 ? ? a ? 0 ?? ? 01 ? rev. 1.00 8? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu simc1 register bit 7 6 5 4 3 2 1 0 name hcf haas hbb htx txak srw rnic rxak r/w r r r r/w r/w r r/w r por 1 0 0 0 0 0 0 1 b it 7 hcf: i 2 c bus data transfer completion fag 0: data is being transferred 1: completion of an 8-bit data transfer the hcf flag is the data transfer flag. this flag will be zero when data is being transferred. upon completion of an 8-bit data transfer the flag will go high and an interrupt will be generated. b it 6 haas: i 2 c bus address match fag 0: not address match 1: address match the hass fag i s t he a ddress m atch fag. t his fag i s used t o de termine i f t he sla ve device address is the same as the master transmit address. if the addresses match then this bit will be high, if there is no match then the fag will be low. b it hbb: i 2 c bus busy fag 0: i 2 c bus is not busy 1: i 2 c bus is busy the hbb flag is the i 2 c busy flag. this flag will be 1 when the i 2 c bus is busy which will occur when a st art signal is detected. the fag will be set to 0 when the bus is free which will occur when a stop signal is detected. b it htx: select i 2 c slave device is transmitter or receiver 0: slave device is the receiver 1: slave device is the transmitter b it 3 txak: i 2 c bus transmit acknowledge fag 0: slave send acknowledge fag 1: slave do not send acknowledge fag the txak bit is the transmit acknowledge fag. after the slave device receipt of 8-bits of data, this bit will be transmitted to the bus on the 9th clock from the slave device. the slave device must always set txak bit to 0 before further data is received. b it 2 srw: i 2 c slave read/write fag 0: slave device should be in receive mode 1: slave device should be in transmit mode the sr w f lag i s t he i 2 c sl ave r ead/write f lag. t his f lag d etermines wh ether the master device wishes to transmit or receive data from the i 2 c bus. when the transmitted address and slave address is match, that is when the haas fag is set high, the slave device will check the sr w fag to determine whether it should be in transmit mode or receive mode. if the sr w fag is high, the master is requesting to read data from the bus, so the slave device should be in transmit mode. when the sr w flag is zero, the master will write data to the bus, therefore the slave device should be in receive mode to read this data. b it 1 rnic : i 2 c running using internal clock control 0: i 2 c running using internal clock 1: i 2 c running not using internal clock the i 2 c module can run w ithout us ing internal clock, and generate an interrupt if the sim interrupt is enabled, which can be used in sleep mode, idle mode, normal(slow) mode.if t his bit is set to 1 and mcu is in halt , slave-receiver can work well but slave-transmitter doesn t work since it needs system clock .
rev. 1.00 8? ?a? 0?? ?01? rev. 1.00 8 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu bit 0 rxak: i 2 c bus receive acknowledge fag 0: slave receive acknowledge fag 1: slave do not receive acknowledge fag the r xak fl ag i s t he r eceiver a cknowledge f lag. w hen t he r xak f lag i s 0, i t means that a acknowledge signal has been received at the 9th clock, after 8 bits of data have been transmitted. when the slave device in the transmit mode, the slave device checks the rxak fag to determine if the master receiver wishes to receive the next byte. t he sl ave t ransmitter wi ll t herefore c ontinue se nding out da ta unt il t he rxak fag is 1. when this occurs, the slave transmitter will release the sda line to allow the master to send a stop signal to release the i 2 c bus. i2ctoc register bit 7 6 5 4 3 2 1 0 name i ? ctoen i ? ctof i ? ctos5 i ? ctos4 i ? ctos ? i ? ctos ? i ? ctos1 i ? ctos0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 b it 7 i2ctoen: i 2 c time-out countrol 0: disable 1: enable bit 6 haas: t ime-out fag 0: no time-out 1: time-out occurred bit 5~0 i2ctos5~i2ctos0: t ime-out defnition i 2 c time-out clock source is f sub /32 i 2 c time-out time is given by: ([i2ctos5 : i2ctos0]+1) (32/f sub ) the simd register is used to store the data being transmitted and received. the same register is used by bot h t he spi a nd i 2 c fun ctions. be fore t he de vice wr ites da ta t o t he i 2 c bus, t he a ctual da ta t o transmitted must be placed in the simd register . after the data is received from the i 2 c bus, the device can read it from the simd register . any transmission or reception of data from the i 2 c bus must be made via the simd register.
rev. 1.00 84 ? a ? 0 ?? ? 01 ? rev. 1.00 85 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu simd register bit 7 6 5 4 3 2 1 0 name d7 d6 d5 d4 d ? d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por x x x x x x x x x unknown sima register bit 7 6 5 4 3 2 1 0 name a6 a5 a4 a ? a ? a1 a0 r/w r/w r/w r/w r/w r/w r/w r/w por x x x x x x x x unknown bit 7~1 a6~a0: i 2 c slave address a6~a0 is the i 2 c slave address bit 6 bit 0. the si ma r egister i s a lso u sed b y t he spi i nterface b ut h as t he n ame si mc2. t he sima register is the location where the 7-bit slave address of the slave device is stored. bits 7~1 of the sima register define the device slave address . bit 0 is not defned. when a master device, which is connected to the i 2 c bus, sends out an address, which matches the slave address in the sima register , the slave device will be selected. note that the sima register is the same register address as simc2 which is used by the spi interface. bit 0 unimplemented, read as "0" i 2 c block diagram
rev. 1.00 84 ?a? 0?? ?01? rev. 1.00 85 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c bus communication communication on the i 2 c bus requires four separate steps, a st art signal, a slave device address transmission, a data transmission and finally a st op signal. when a st art signal is placed on the i 2 c bus, all devices on the bus will receive this signal and be notifed of the imminent arrival of data on the bus. the frst seven bits of the data will be the slave address with the frst bit being the msb. if the address of the slave device matches that of the transmitted address, the haas bit in the simc1 register will be set and an i 2 c interrupt will be generated. after entering the interrupt service routine, the slave device must frst check the condition of the haas bit to determine whether the interrupt source originates from an address match or from the comple tion of an 8-bit data transfer . during a data transfer , note that after the 7-bit slave address has been transmitted, the following bit, which is the 8th bit, is the read/writ e bit whose value will be placed in the sr w bit. this bit will be checked by the slave device to determine whether to go into transmit or receive mode. before any transfer of data to or from the i 2 c bus, the microcontroller must init ialise the bus, the following are steps to achieve this: ? step 1 set the sim2~sim0 and simen bits in the simc0 register to 1 to enable the i 2 c bus. ? step 2 write the slave address of the device to the i 2 c bus address register sima. ? step 3 set the sime interrupt enable bit of the interrupt control register to enable the sim interrupt . i 2 c bus initialisation flow chart
rev. 1.00 86 ? a ? 0 ?? ? 01 ? rev. 1.00 87 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c bus start signal the st art signal can only be generated by the master device connec ted to the i 2 c bus and not by the slave device. this st art signal will be detected by all devices connected to the i 2 c bus. when detected, this indicates that the i 2 c bus is busy and therefore the hbb bit will be set. a st art condition occurs when a high to low transition on the sda line takes place when the scl line remains high. slave address the t ransmission o f a st art si gnal b y t he m aster wi ll b e d etected b y a ll d evices o n t he i 2 c b us. to determine which slave device the master wishes to communicate with, the address of the slave device will be sent out immediately following the st art signal. all slave devices, after receiving this 7-bit address data, will compare it with their own 7-bit slave address. if the address sent out by the maste r matche s the internal address of the microcontroller slave device, then an internal i 2 c bus interrupt signal wil l be generat ed. the next bit fol lowing the address, which is the 8th bit, defnes the read/write status and will be saved to the sr w bit of the simc1 register . the slave device will then transmit an acknowledge bit, which is a low level, as the 9th bit. the slave device will also set the status fag haas when the addresses match. as an i 2 c bus interrupt can come from two sources, when the program enters the interrupt subroutine, t he haas bi t shoul d be e xamined t o se e whe ther t he i nterrupt sourc e ha s c ome from a matching slave address or from the completion of a data byte transfer . when a slave address is matched, the device must be placed in either the transmit mode and then w rite data to the s imd register, or in the receive mode where it must implement a dummy read from the simd register to release the scl line. i 2 c bus read/write signal the sr w bit in the simc1 registe r defnes whether the slave device wishes to read data from the i 2 c bus or write data to the i 2 c bus. the slave device should examine this bit to determine if it is to be a transmitter or a receiver . if the sr w fag is 1 then this indicates that the master device wishes to read data from the i 2 c bus, therefore the slave device must be setup to send data to the i 2 c bus as a transmitter . if the sr w fag is 0 then this indicates that the master wishes to send data to the i 2 c bus, therefore the slave device must be setup to read data from the i 2 c bus as a receiver. i 2 c bus slave address acknowledge signal after the mas ter has trans mitted a calling addres s, any s lave device on the i 2 c bus , w hose own internal address matches the calling address, must generate an acknowledge signal. the acknowledge signal will inform the master that a slave device has accepted its calling address. if no acknowledge signal is received by the master then a st op signal must be transmitted by the master to end the communication. when the haas fag is high, the addresses have matched and the slave device must check the sr w fag to determine if it is to be a transmitter or a receiver . if the sr w fag is high, the slave device should be setup to be a transmitter so the htx bit in the simc1 register should be set to 1. if the sr w fag is low , then the microcontroller slave device should be setup as a receiver and the htx bit in the simc1 register should be set to 0.
rev. 1.00 86 ?a? 0?? ?01? rev. 1.00 87 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c bus data and acknowledge signal the transmitted data is 8-bits wide and is transmitted after the slave device has acknowledged receipt of i ts sla ve a ddress. t he orde r of seri al bi t t ransmission i s t he msb fi rst a nd t he l sb l ast. afte r receipt of 8-bits of data, the receiver must transmit an acknowledge signal, level 0, before it can receive the next data byte. if the slave transmitter does not receive an acknowledge bit signal from the master receiver , then the slave transmitter will release the sda line to allow the master to send a st op si gnal t o re lease t he i 2 c bus. t he c orresponding da ta wi ll be st ored i n t he simd re gister. if setup as a transmitt er, the slave de vice must frst writ e the da ta to be transmitt ed into the simd register. if setup as a receiver, the slave device must read the transmitted data from the simd register. when the slave receiver receives the data byte, it must generate an acknowledge bit, known as txak, on the 9th clock. the slave device, which is setup as a transmi tter will check the rxak bit in the simc1 register to determine if it is to send another data byte, if not then it will release the sda line and await the receipt of a stop signal from the master. i 2 c communication timing diagram note: *when a slave address is matched, the device must be placed in either the transmit mode and then write data to the simd register , or in the receive mode where it must implement a dummy read from the simd register to release the scl line.
rev. 1.00 88 ? a ? 0 ?? ? 01 ? rev. 1.00 89 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c bus isr flow chart
rev. 1.00 88 ?a? 0?? ?01? rev. 1.00 89 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu i 2 c time-out control in order to reduce the problem of i 2 c lockup due to reception of erroneous clock sources, clock, a time-out function is provided. if the clock source to the i 2 c is not received then after a fxed time period, the i 2 c circuitry and registers will be reset. the time-out counter starts counting on an i 2 c bus st art and address match condition, and is cleared b y a n sc l f alling e dge. b efore t he n ext sc l f alling e dge a rrives, i f t he t ime e lapsed i s greater than the time-out setup by the i2ct oc regis ter, then a time-out condition w ill occur . the time-out function will stop when an i 2 c stop condition occurs. when an i 2 c time -out counte r overfow occurs, the counter will stop and the i2ct oen bit will be cleared to zero and the i2ct o f bit will be set high to indicate that a time-out condition as occurred. the time-out c ondition wi ll a lso ge nerate a n i nterrupt whi ch use s t he i 2 c i nterrrupt ve ctor. w hen an i 2 c time-out occurs , the i 2 c i nternal circuitry will be reset and the registers will be reset into the following condition: register after i 2 c time-out si ? d ? si ? a ? si ? c0 no change si ? c1 reset to por condition i 2 c registers after time-out the i2ct of f ag can be cleared by the application program. there are 64 time-out periods w hich can be selected using bits in the i2ctoc register. the time-out time is given by the formula: ((1~64) 32)/f sub this gives a range of about 1ms to 64ms. note also that the lirc oscillator is continuously enabled.
rev. 1.00 90 ? a ? 0 ?? ? 01 ? rev. 1.00 91 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu interrupts interrupts are an important part of any microcontroller s ystem. when an external event or an internal function such as a t ouch action or t imer/event counter overfow requires microcontroller attention, their corres ponding interrupt w ill enforce a temporary s uspension of the main program allowing the microcontroller to direct attention to their respective needs. the device s contain several external interrupt and internal interr upts functions. the external interru pt is generated by the action of the external int pin, while the internal interrupts are generated by various internal functions such as the t ouch keys, t imer/event counter, t ime base, sim etc. interrupt registers overall interrupt control, w hich bas ically means the s etting of reques t flags w hen certain microcontroller conditions occur and the setting of interrupt enable bits by the application program, is control led by a series of registers, located in the special purpose data memory , as shown in the accompanying table. the number of registers depends upon the device chosen but fall into three categories. the frst is the intc0~intc 1 registers which setup the primary interrupts, the second is the integ registers to setup the external interrupt trigger edge type. each regist er contai ns a number of enable bit s to enable or disa ble indivi dual regist ers as wel l as interrupt flags to indicate the presence of an interrupt request. the naming convention of these follows a specifc pattern. first is listed an abbreviated interrupt type, then the (optional) number of that interrupt followed by either an e for enable/disable bit or f for request fag. function enable bit request flag notes global e ? i int pin inte intf touch ke ? ? odule tk ? e tk ? f si ? si ? e si ? f eepro ? dee def time base tbe tbf timer/event counter te tf interrupt register bit naming conventions interrupt register contents name bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 integ ints1 ints0 intc0 tf tk ? f intf te tk ? e inte e ? i intc1 def tbf si ? f dee tbe si ? e integ register bit 7 6 5 4 3 2 1 0 name ints1 ints0 r/w r/w r/w por 0 0 bit 7~2 unimplemented, read as "0" bit 1~0 ints1, ints0: defnes int interrupt active edge 00: disabled interrupt 01: rising edge interrupt 10: falling edge interrupt 11: dual edge interrupt
rev. 1.00 90 ?a? 0?? ?01? rev. 1.00 91 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu intc0 register bit 7 6 5 4 3 2 1 0 name tf tk ? f intf te tk ? e inte e ? i r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 bit 7 unimplemented, read as "0" bit 6 tf: t imer/event counter interrupt request fag 0: no request 1: interrupt request bit 5 tkmf: t ouch key module interrupt request fag 0: no request 1: interrupt request bit 4 intf: int pin interrupt request fag 0: no request 1: interrupt request bit 3 te: t imer/event counter interrupt control 0: disable 1: enable bit 2 tkme: t ouch key module interrupt control 0: disable 1: enable bit 1 inte: int pin interrupt control 0: disable 1: enable bit 0 emi: global interrupt control 0: disable 1: enable
rev. 1.00 9 ? ? a ? 0 ?? ? 01 ? rev. 1.00 9? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu intc1 register bit 7 6 5 4 3 2 1 0 name def tbf si ? f dee tbe si ? e r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7 unimplemented, read as "0" bit 6 def: data eeprom interrupt request fag 0: no request 1: interrupt request bit 5 tbf: t ime base interrupt request fag 0: no request 1: interrupt request bit 4 simf: sim interrupt request fag 0: no request 1: interrupt request bit 3 unimplemented, read as "0" bit 2 dee: data eeprom control 0: disable 1: enable bit 1 tbe: t ime base interrupt control 0: disable 1: enable bit 0 sime: sim interrupt control 0: disable 1: enable
rev. 1.00 9? ?a? 0?? ?01? rev. 1.00 9 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu interrupt operation when the conditions for an interrupt event occur , such as a t ouch key counter overflow , timer/event counter overflow , etc, the relevant interrupt request flag will be set. whether the request flag actually generates a program jump to the relevant interrupt vector is determined by the condition of the interrupt enabl e bit. if the enable bit is set high then the program will jump to its relevant vector; if the enable bit is zero then although the interrupt request fag is set an actual interrupt will not be generated and the program will not jump to the relevant interrupt vector . the global interrupt enable bit, if cleared to zero, will disable all interrupts. when an interrupt is generated, the program counter, which stores the address of the next instruction to be executed, will be transferred onto the stack. the program counter will then be loaded with a new address which will be the value of the corresponding interrupt vector . the microcontroller will then fetch its next instruction from this interrupt vector . the instruction at this vector will usually be a jmp which will jump to another section of program which is known as the interrupt service routine. here is located the code to control the appropriate interrupt. the interrupt service routine must be terminated w ith a reti, w hich retrieves the original p rogram counter address from the st ack a nd a llows t he m icrocontroller t o c ontinue wi th n ormal e xecution a t t he p oint wh ere t he interrupt occurred. the various interrupt enable bits, together with their associated request flags, are shown in the accompanying diagrams with their order of priority . some interrupt sources have their own individual vector w hile others s hare the s ame multi-function interrupt vector . once an interrupt subroutine is serviced, all the other interrupts will be blocked, as the global interrupt enable bit, emi bit will be cleared automatically . this will prevent any further interrupt nesting from occurring. however, i f ot her i nterrupt re quests oc cur duri ng t his i nterval, a lthough t he i nterrupt wi ll not be immediately serviced, the request fag will still be recorded. if an interrupt requires immediate servicing while the program is alread y in another interrupt service routine, the emi bit should be set after entering the routine, to allow interrupt nesting. if the stack is full, the interrupt request will not be acknowledged, even if the related interrupt is enabled, until the stack pointer is decremented. if immediate service is desired, the stack must be prevented from becoming full. in case of simultaneous requests, the accompanying diagram shows the priority that is a pplied. all o f t he i nterrupt r equest fa gs wh en se t wi ll wa ke-up t he d evice i f i t i s i n sl eep o r idle mode, however to prevent a wake-up from occurring the corresponding fag should be set before the device is in sleep or idle mode. external touch ke? ?odule intf tk?f inte tk?e e?i 04h e?i 08h 10h si? si?f si?e e?i 18 h eepro? def dee e?i interrupt name request flags enable bits ?aster enable vector e?i auto disabled in isr low priorit? high xxe enable bits xxf request flag ? auto reset in isr legend xxf request flag ? no auto reset in isr 0c h 14h tbf tbe e?i timer/event counter tf te e?i time base interrupt structure
rev. 1.00 94 ? a ? 0 ?? ? 01 ? rev. 1.00 95 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu external interrupt the e xternal i nterrupt is c ontrolled by si gnal t ransitions on t he pi n int . an e xternal i nterrupt request will take place when the external interrupt request flag, intf , is set, which will occur when a transition, whose type is chosen by the edge select bits, appears on the external interrupt pin. t o allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, emi, and respective external interrupt enable bit, inte, must frst be set. additionally the correc t i nterrupt edge t ype must be se lected usi ng t he int eg regi ster t o ena ble t he ext ernal interrupt function and to choose the trigger edge type. as the external interrupt pin is pin-shared with i/o pin, its can only be confgured as external interrupt pin if its external interrupt enable bit in the corresponding interrupt register has been set. the pin must also be setup as an input by setting the corresponding bit in the port control register . when the interrupt is enabled, the stack is not full and the correct transition type appears on the external interrupt pin, a subroutine call to the external interrupt vector , will take place. when the interrupt is serviced, the external interrupt request fag, intf, will be automatically reset and the emi bit will be automatically cleared to disable other interrupts. note that any pull-high resistor selections on the external interrupt pin will remain valid even if the pin is used as an external interrupt input. the integ register is used to select the type of active edge that will trigger the external interrupt. a choice of either rising or falling or both edge types can be chosen to trigger an external interrupt. note that the integ register can also be used to disable the external interrupt function. time base interrupt the function of the t ime base interrupt is to provide regular time signal in the form of an internal interrupt. it is controlled by the overflow signal from its timer function. when th is happens its interrupt request flags tbf will be set. t o allow the program to branch to its interrupt vector address, the global interrupt enable bit, emi and t ime base enable bit, tbe, must frst be set. when the interrupt is enabled, the stack is not full and the t ime base overfows, a subroutine call to its vector location will take place. when the interrupt is serviced, the interrupt request fag, tbf , will be automatically reset and the emi bit will be cleared to disable other interrupts. the purpose of the t ime base interrupt is to provide an interrupt signal at fxed time periods. its clock source originate from the internal clock source f sys or f sub . this f tp input clock passes through a di vider, t he di vision ra tio of whi ch i s se lected by progra mming t he a ppropriate bi ts i n t he t bc register to obtain longer interrupt periods whose value ranges. the clock source that generates f tp , which in turn controls the t ime base interrupt period, can originate from several dif ferent sources, as shown in the system operating mode section.
rev. 1.00 94 ?a? 0?? ?01? rev. 1.00 95 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu tbc register bit 7 6 5 4 3 2 1 0 name tb1 tb0 r/w r/w r/w por 0 0 bit 7~6 unimplemented, read as "0" bit 5~4 tb1~tb0: select t ime base t ime-out period 00: 1024/f 01: 2048/f 10: 4096/f 11: 8192/f bit 3~0 unimplemented, read as "0" time base structure timer/event counter interrupt for a t imer/event counter interrupt to occur , the global interrupt enable bit, em i, and the corresponding timer interrupt enable bit, te, must first be set. an actual t imer/event counter interrupt will take place when the t imer/event counter request fag, tf , is set, a situation that will occur when the relevant t imer/event counter overfows. when the interrupt is enabled, the stack is not ful l and a t imer/event counte r n overfl ow oc curs, a subrouti ne c all t o t he relevant t imer interrupt vector , will take place. when the interrupt is serviced, the timer interrupt request fag, tf , will be automatically reset and the emi bit will be automatically cleared to disable other interrupts. eeprom interrupt an eeprom interrupt request will take place when the eeprom interrupt request fag, def, is set, which occurs when an eeprom w rite cycle ends. t o allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, emi, and eeprom interrupt enable bit, dee, must frst be set. when the interrupt is enabled, the stack is not full and an eeprom w rite cycle ends, a subroutine call to the respective eeprom interrupt vect or, will take place. when the eeprom interrupt is serviced, the def fag will be automatically cleared and the emi bit will be automatically cleared to disable other interrupts.
rev. 1.00 96 ? a ? 0 ?? ? 01 ? rev. 1.00 97 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu touch key interrupt for a t ouch key interrupt to occur , the global interrupt enable bit, emi, and the corresponding touch key interru pt enable tkme must be frst set. an actual t ouch key interrupt will take place when the touch key request fag. tkmf , is set, a situation that will occur when the time slot counter overfows. when the interrupt is enabled, the stack is not full and the touch key time slot counter overfow occurs, a subroutine call to the relevant timer interrupt vector , will take place. when the interrupt is serviced, the t ouch key interrupt request fag, tkmf , will be automatically reset and the emi bit will be automatically cleared to disable other interrupts. the tkcfov flag, which is the 16-bit c/f counter overflow flag will go high when a ny of the touch k ey m odule 16-bit c/f counter overf ow s. as this f ag w ill not be automatically cleared, it has to be cleared by the application program. module 0 o nly contains one 16-bit counter . the tk16ov fag, which is the 16-bit counter overfow fag will go high when the 16-bit counter overfow s. as this fag will not be automatically cleared, it has to be cleared by the application program. sim interrupt a sim in terrupt re quest wi ll t ake pl ace whe n t he sim in terrupt re quest fa g, simf , i s se t, whi ch occurs when a byte of data has been received or transmitted by the sim interface. t o allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, emi, and the serial interface interrupt enable bit, sime, must frst be set. when the interrupt is enabled, the st ack i s not full a nd a byt e of da ta ha s be en t ransmitted or re ceived by t he sim i nterface, a subroutine call to the respective interrupt vector , will take place. when the serial interface interrupt is service d, the sim interrupt request fag, si m f, will be automatically cleared and the emi bit will be automatically cleared to disable other interrupts. interrupt wake-up function each of the int errupt funct ions has the ca pability of waki ng up the mi crocontroller when in the sleep or idle mode. a wake-up is generated when an interrupt request fag changes from low to high and is independent of whether the interrupt is enabled or not. therefore, even though the device is in the sleep or idle mode and its system oscillator stopped, situations such as external edge transitions o n t he e xternal i nterrupt p ins, a l ow p ower su pply v oltage o r c omparator i nput c hange may cause their respective interrupt fag to be set high and consequent ly generate an interrupt. care must therefore be taken if spurious wake-up situations are to be avoided. if an interrupt wake-up function is to be disabled then the corresponding interrupt request fag should be set high before the device enters the sleep or idle mode. the interrupt enable bits have no ef fect on the interrupt wake-up function.
rev. 1.00 96 ?a? 0?? ?01? rev. 1.00 97 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu programming considerations by di sabling t he re levant i nterrupt e nable bi ts, a re quested i nterrupt c an be pre vented from be ing serviced, however , once an interrupt request flag is set, it will remain in this condition in the interrupt register until the corresponding interrupt is serviced or until the request fag is cleared by the application program. it is recommended that programs do not use the call instruction within the interrupt service subroutine. interrupts often occur in an unpredictable manner or need to be serviced immediately . if only one stack is left and the inte rrupt is not well controlled, the original control sequence will be damaged once a call subroutine is executed in the interrupt subroutine. every i nterrupt h as t he c apability o f wa king u p t he m icrocontroller wh en i t i s i n sl eep o r i dle mode, the wake up being generated when the interrupt request fag changes from low to high. if it is required to prevent a certain interru pt from waking up the microcontrol ler then its respective request fag should be frst set high before enter sleep or idle mode. as only the program counter is pushed onto the stack, then when the interrupt is serviced, if the contents of the accumulator , status register or other registers are altered by the interrupt service program, t heir c ontents shoul d be sa ved t o t he m emory a t t he be ginning of t he i nterrupt se rvice routine. to return from an interrupt subroutine, either a ret or reti instruction may be executed. the reti instruction in addition to executing a return to the main program also automatically sets the emi bit high to allow further interrupts. the ret instruction however only executes a return to the main program leaving the emi bit in its present zero state and therefore disabling the execution of further interrupts.
rev. 1.00 98 ? a ? 0 ?? ? 01 ? rev. 1.00 99 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu application circuits note: it is recommended that this component is added for added esd protection. it is recommended that this component is added in environments where power line noise is signifcant.
rev. 1.00 98 ?a? 0?? ?01? rev. 1.00 99 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu instruction set instruction central to the successful operation of any microcontroller is its instruction set, which is a set of program instruction codes that direc ts the microcontroller to perform certain operations. in the case of holtekmicrocontrollers, a comprehensive and fexible set of over 60 instructions is provided to enable programmers to implement their application with the minimum of programming overheads. for easier understanding of the various instruction codes, they have been subdivided into several functional groupings instruction timing most instructions are implemented within one instruction cycle. the exceptions to this are branch, call, or table read instructions where two ins truction cycles are required. one instruction cycle is equal to 4 system clock cycles, therefore in the case of an 8mhz system oscillator , most instructions would be i mplemented wi thin 0.5 s a nd bra nch or c all i nstructions woul d be i mplemented wi thin 1us. alt hough i nstructions whi ch re quire one m ore c ycle t o i mplement a re ge nerally l imited t o the jmp , call, ret , reti and table read instructions, it is important to realize that any other instructions which involve manipulation of the program counter low register or pcl will also take one more cycle to implement. as instructions which change the contents of the pcl will imply a direct j ump t o t hat ne w a ddress, one m ore c ycle wi ll be re quired. e xamples of suc h i nstructions would be clr pcl or mov pcl, a. for the case of skip instructions, it must be noted that if the result of the comparison involves a skip operation then this will also take one more cycle, if no skip is involved then only one cycle is required. moving and transferring data the t ransfer of da ta wi thin t he m icrocontroller progra m i s one of t he m ost fre quently use d operations. making use of three kinds of mov instructions, data can be transferred from registers to the accumulator and vice-versa as well as being able to move specifc immediate data directly into the ac cumulator. one of t he m ost i mportant da ta t ransfer a pplications i s t o re ceive da ta from t he input ports and transfer data to the output ports. arithmetic operations the ability to perform certain arithm etic operations and data manipula tion is a necessary feature of most m icrocontroller a pplications. w ithin t he hol tek m icrocontroller i nstruction se t a re a ra nge of add and subtract instruction mnemonics to enable the necessary arithmetic to be carried out. care must be taken to ens ure correct handling of carry and borrow data w hen res ults exceed 255 for addition and less than 0 for subtraction. the increment and decrement instructions inc, inca, dec and deca provide a simple means of increasing or decreasing by a value of one of the values in the destination specifed.
rev. 1.00 100 ? a ? 0 ?? ? 01 ? rev. 1.00 101 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu logical and rotate operations the standard logical operations such as and, or, xor and cpl all have their own instruction within t he hol tek m icrocontroller i nstruction set . as wi th t he c ase of m ost i nstructions i nvolving data m anipulation, d ata m ust p ass t hrough t he ac cumulator wh ich m ay i nvolve a dditional programming steps. in all logical data operations, the zero flag may be set if the result of the operation is zero. another form of logical data manipulation comes from the rotate instructions such as rr, rl, rrc and rlc which provide a simple means of rotating one bit right or left. dif ferent rotate instructions exist depending on program requirements. rotate instructions are useful for serial port progra mming a pplications whe re da ta c an be rot ated from a n i nternal re gister i nto t he ca rry bit from where it can be examined and the necessary serial bit set high or low . another application where rotate data operations are used is to implement multiplication and division calculations. branches and control transfer program branching takes the form of either jumps to specifed locations using the jmp instruction or to a subroutine using the call instruction. they dif fer in the sense that in the case of a subroutine call, the program must return to the instruction immediately when the subroutine has been carried out. this is done by placing a return instruction ret in the subroutine which will cause the program to jump back to the address right after the call instruction. in the case of a jmp instruction, the program simply jumps to the desired location. there is no requirement to jump back to the original jumping of f poi nt as in the case of the call instruct ion. one special and extremely useful set of branch instructions are the conditional branches. here a decision is first made regarding the condition of a certain data memory or individual bits. depending upon the conditions, the program will continue with the next instruction or skip over it and jump to the following instruction. these instructions are the key to decision making and branching within the program perhaps determined by the condition of certain input switches or by the condition of internal data bits. bit operations the abili ty to provide single bit operations on data memory is an extremely fexible feature of all holtek microcontrollers. this feature is especially useful for output port bit programming where individual bits or port pins can be directly set high or low using either the set [m].i or clr [m].i instructions respectively . the feature removes the need for programmers to frst read the 8-bit output port, manipulate the input data to ensure that other bits are not changed and then output the port with the correct new data. this read-modify-write process is taken care of automatically when these bit operation instructions are used. table read operations data st orage i s norm ally i mplemented by usi ng re gisters. howeve r, whe n working wi th l arge amounts of fxed data, the volume involved often makes it inconvenient to store the fxed data in the data memory . t o overcome this problem, holtek microcontrollers allow an area of program memory to be setup as a table where data can be directly stored. a set of easy to use instructions provides the means by w hich this fixed data can be referenced and retrieved from the program memory. other operations in addition to the above functional instructions, a range of other instructions also exist such as the hal t instruction for power -down operations and instructions to control the operation of the w atchdog t imer for reliable program operations under extreme electric or electromagnetic environments. for their relevant operations, refer to the functional related sections.
rev. 1.00 100 ?a? 0?? ?01? rev. 1.00 101 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu instruction set summary the following table depicts a summary of the instruction set categorised according to function and can be consulted as a basic instruction reference using the following listed conventions. table conventions x: bits immediate data m: data memory address a: accumulator i: 0~7 number of bits addr: program memory address mnemonic description cycles flag affected arithmetic add a ? [m] add ? a ? [m] add a ? x adc a ? [m] adc ? a ? [m] sub a ? x sub a ? [m] sub ? a ? [m] sbc a ? [m] sbc ? a ? [m] daa [m] add data ? emor ? to acc add acc to data ? emor ? add immediate data to acc add data ? emor ? to acc with carr ? add acc to data memor ? with carr ? subtract immediate data from the acc subtract data ? emor ? from acc subtract data ? emor ? from acc with result in data ? emor ? subtract data ? emor ? from acc with carr ? subtract data ? emor ? from acc with carr ?? result in data ? emor ? decimal adjust acc for addition with result in data ? emor ? 1 1 note 1 1 1 note 1 1 1 note 1 1 note 1 note z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov z ? c ? ac ? ov c logic operation and a ? [m] or a ? [m] xor a ? [m] and ? a ? [m] or ? a ? [m] xor ? a ? [m] and a ? x or a ? x xor a ? x cpl [m] cpla [m] logical and data ? emor ? to acc logical or data ? emor ? to acc logical xor data ? emor ? to acc logical and acc to data ? emor ? logical or acc to data ? emor ? logical xor acc to data ? emor ? logical and immediate data to acc logical or immediate data to acc logical xor immediate data to acc complement data ? emor ? complement data ? emor ? with result in acc 1 1 1 1 note 1note 1note 1 1 1 1note 1 z z z z z z z z z z z increment & decrement inca [m] inc [m] deca [m] dec [m] increment data ? emor ? with result in acc increment data ? emor ? decrement data ? emor ? with result in acc decrement data ? emor ? 1 1 note 1 1note z z z z rotate rra [m] rr [m] rrca [m] rrc [m] rla [m] rl [m] rlca [m] rlc [m] rotate data ? emor ? right with result in acc rotate data ? emor ? right rotate data ? emor ? right through carr ? with result in acc rotate data ? emor ? right through carr ? rotate data ? emor ? left with result in acc rotate data ? emor ? left rotate data ? emor ? left through carr ? with result in acc rotate data ? emor ? left through carr ? 1 1 note 1 1 note 1 1 note 1 1 note none none c c none none c c data move ? ov a ? [m] ? ov [m] ? a ? ov a ? x ? ove data ? emor ? to acc ? ove acc to data ? emor ? ? ove immediate data to acc 1 1 note 1 none none none
rev. 1.00 10 ? ? a ? 0 ?? ? 01 ? rev. 1.00 10? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu mnemonic description cycles flag affected bit operation clr [m].i set [m].i clear bit of data ? emor ? set bit of data ? emor ? 1 note 1 note none none branch j ? p addr sz [m] sza [m] sz [m].i snz [m].i siz [m] sdz [m] siza [m] sdza [m] call addr ret ret a ? x reti jump unconditionall ? skip if data ? emor ? is zero skip if data ? emor ? is zero with data movement to acc skip if bit i of data ? emor ? is zero skip if bit i of data ? emor ? is not zero skip if increment data ? emor ? is zero skip if decrement data ? emor ? is zero skip if increment data ? emor ? is zero with result in acc skip if decrement data ? emor ? is zero with result in acc subroutine call return from subroutine return from subroutine and load immediate data to acc return from interrupt ? 1 note 1 note 1 note 1 note 1 note 1 note 1 note 1 note ? ? ? ? none none none none none none none none none none none none none table read tabrdc [m] tabrdl [m] read table to tblh and data ? emor ? read table (last page) to tblh and data ? emor ? ? note ? note none none miscellaneous nop clr [m] set [m] clr wdt clr wdt1 clr wdt ? swap [m] swapa [m] halt no operation clear data ? emor ? set data ? emor ? clear watchdog timer pre-clear watchdog timer pre-clear watchdog timer swap nibbles of data ? emor ? swap nibbles of data ? emor ? with result in acc enter power down mode 1 1 note 1 note 1 1 1 1 note 1 1 none none none to ? pdf to ? pdf to ? pdf none none to ? pdf note: 1. for skip instructions, if the result of the comparison involves a skip then two cycles are required, if no skip takes place only one cycle is required. 2. any instruction which changes the contents of the pcl will also require 2 cycles for execution. 3. for the clr wdt1 and clr wdt2 instructions the t o and pdf flags may be af fected by the execution st atus. t he t o a nd pdf fl ags a re c leared a fter bot h clr w dt1 a nd clr w dt2 instructions are consecutively executed. otherwise the t o and pdf fags remain unchanged.
rev. 1.00 10? ?a? 0?? ?01? rev. 1.00 10 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu instruction defnition adc a,[m] add d ata m emory to a cc w ith carry description the c ontents o f t he s pecifed d ata m emory, a ccumulator a nd t he c arry f ag a re a dded. the re sult is s tored in t he a ccumulator. operation acc a cc + [ m] + c affected f ag(s) ov, z , a c, c adcm a,[m] add a cc to d ata m emory w ith carry description the c ontents o f t he s pecifed d ata m emory, a ccumulator a nd t he c arry f ag a re a dded. the re sult is s tored in t he sp ecifed d ata m emory. operation [m] a cc + [ m] + c affected f ag(s) ov, z , a c, c add a,[m] add d ata m emory t o a cc description the c ontents o f t he s pecifed d ata m emory a nd t he a ccumulator a re a dded. the re sult is s tored in t he a ccumulator. operation acc a cc + [ m] affected f ag(s) ov, z , a c, c add a,x add im mediate data to a cc description the c ontents o f t he a ccumulator a nd t he s pecifed im mediate data a re a dded. the re sult is s tored in t he a ccumulator. operation acc a cc + x affected f ag(s) ov, z , a c, c addm a,[m] add a cc to d ata m emory description the c ontents o f t he s pecifed d ata m emory a nd t he a ccumulator a re a dded. the re sult is s tored in t he sp ecifed d ata m emory. operation [m] a cc + [ m] affected f ag(s) ov, z , a c, c and a,[m] logical a nd d ata m emory t o a cc description data i n t he a ccumulator a nd t he s pecifed d ata m emory p erform a b itwise l ogical a nd operation. t he re sult is s tored in t he a ccumulator. operation acc a cc a nd [ m] affected f ag(s) z and a,x logical a nd im mediate data to a cc description data i n t he a ccumulator a nd t he s pecifed im mediate data p erform a b it w ise l ogical a nd operation. t he re sult is s tored in t he a ccumulator. operation acc a cc a nd x affected f ag(s) z andm a,[m] logical a nd a cc to d ata m emory description data i n t he s pecifed d ata m emory a nd t he a ccumulator p erform a b itwise l ogical a nd operation. t he re sult is s tored in t he d ata m emory. operation [m] a cc and [ m] affected f ag(s) z
rev. 1.00 104 ? a ? 0 ?? ? 01 ? rev. 1.00 105 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu call addr subroutine c all description unconditionally c alls a s ubroutine a t t he s pecifed a ddress. th e p rogram c ounter t hen increments b y 1 to o btain t he a ddress o f t he n ext i nstruction w hich i s t hen p ushed o nto t he stack. t he sp ecifed a ddress is t hen loaded a nd t he p rogram c ontinues e xecution f rom t his new a ddress. a s t his instruction re quires a n a dditional op eration, it is a t wo c ycle instruction. operation stack p rogram counter + 1 program c ounter a ddr affected f ag(s) none clr [m] clear d ata m emory description each b it o f t he s pecifed d ata m emory i s cl eared t o 0 . operation [m] 00h affected f ag(s) none clr [m].i clear bi t o f d ata m emory description bit i o f t he s pecifed d ata m emory i s cl eared t o 0 . operation [m].i 0 affected f ag(s) none clr wdt clear w atchdog t imer description the t o, p df f ags a nd t he w dt a re al l c leared. operation wdt cl eared to 0 pdf 0 affected f ag(s) to, p df clr wdt1 pre-clear w atchdog t imer description the t o, p df f ags a nd t he w dt a re a ll c leared. n ote t hat t his instruction w orks in conjunction w ith c lr w dt2 a nd m ust b e e xecuted al ternately w ith c lr w dt2 to h ave effect. r epetitively e xecuting t his i nstruction w ithout al ternately e xecuting c lr w dt2 w ill have no e ffect. operation wdt cl eared to 0 pdf 0 affected f ag(s) to, p df clr wdt2 pre-clear w atchdog t imer description the t o, p df f ags and t he w dt are all cleared. n ote t hat t his i nstruction w orks i n conjunction with c lr w dt1 a nd m ust b e e xecuted al ternately w ith c lr w dt1 to h ave e ffect. r epetitively e xecuting t his i nstruction w ithout al ternately e xecuting c lr w dt1 w ill h ave n o e ffect. operation wdt cl eared to 0 pdf 0 affected f ag(s) to, p df cpl [m] complement d ata m emory description each b it of t he s pecifed d ata m emory i s l ogically complemented ( 1s complement). b its w hich previously c ontained a 1 a re c hanged to 0 a nd v ice v ersa. operation [m] [m] affected f ag(s) z
rev. 1.00 104 ?a? 0?? ?01? rev. 1.00 105 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu cpla [m] complement d ata m emory w ith r esult i n a cc description each b it of t he s pecifed d ata m emory i s l ogically complemented ( 1s complement). b its w hich previously c ontained a 1 a re c hanged to 0 a nd v ice v ersa. th e c omplemented r esult i s s tored i n the a ccumulator a nd t he c ontents o f t he d ata m emory r emain u nchanged. operation acc [ m] affected f ag(s) z daa [m] decimal-adjust a cc f or addition w ith r esult i n d ata m emory description convert t he c ontents o f t he a ccumulator v alue to a b cd ( binary c oded d ecimal) v alue resulting f rom t he p revious a ddition o f t wo b cd v ariables. i f t he low n ibble is greater t han 9 or i f a c f ag i s s et, t hen a v alue o f 6 w ill b e a dded to t he l ow n ibble. o therwise t he l ow n ibble remains u nchanged. i f t he h igh n ibble i s g reater t han 9 o r i f t he c f ag i s s et, t hen a v alue o f 6 will b e a dded to t he h igh n ibble. e ssentially, t he decimal c onversion i s p erformed b y a dding 00h, 0 6h, 6 0h o r 6 6h depending o n t he a ccumulator a nd f ag c onditions. o nly t he c f ag may b e a ffected b y t his instruction w hich indicates t hat if t he o riginal b cd s um is greater t han 100, it al lows m ultiple p recision decimal a ddition. operation [m] a cc + 00h or [m] a cc + 06 h o r [m] a cc + 60h o r [m] a cc + 66h affected f ag(s) c dec [m] decrement d ata m emory description data i n t he s pecifed d ata m emory i s d ecremented b y 1 . operation [m] [ m] ? 1 affected f ag(s) z deca [ m] decrement d ata m emory wi th r esult i n a cc description data in t he sp ecifed d ata m emory is d ecremented b y 1 . t he re sult is s tored in t he accumulator. th e c ontents o f t he d ata m emory r emain u nchanged. operation acc [ m] ? 1 affected f ag(s) z halt enter p ower down m ode description this i nstruction s tops t he p rogram e xecution a nd t urns o ff t he s ystem c lock. th e c ontents o f the d ata m emory a nd r egisters a re r etained. th e w dt a nd p rescaler a re c leared. th e p ower down f ag p df i s s et a nd t he w dt t ime-out f ag t o i s c leared. operation to 0 pdf 1 affected f ag(s) to, p df inc [m] increment d ata m emory description data in t he sp ecifed d ata m emory is incremented b y 1 . operation [m] [ m] + 1 affected f ag(s) z inca [m] increment d ata m emory wi th r esult i n a cc description data i n t he sp ecifed d ata m emory i s i ncremented b y 1 . th e re sult i s s tored i n t he a ccumulator. the c ontents o f t he d ata m emory r emain u nchanged. operation acc [ m] + 1 affected f ag(s) z
rev. 1.00 106 ? a ? 0 ?? ? 01 ? rev. 1.00 107 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu jmp addr jump u nconditionally description the c ontents o f t he p rogram c ounter a re re placed w ith t he sp ecifed a ddress. p rogram execution t hen c ontinues f rom t his n ew a ddress. a s t his re quires t he insertion o f a d ummy instruction w hile t he n ew a ddress is loaded, it is a t wo c ycle instruction. operation program counter addr affected f ag(s) none mov a,[m] move d ata m emory t o a cc description the c ontents o f t he s pecifed d ata m emory a re c opied to t he a ccumulator. operation acc [ m] affected f ag(s) none mov a,x move im mediate data to a cc description the im mediate data s pecifed i s l oaded i nto t he a ccumulator. operation acc x affected f ag(s) none mov [m],a move a cc to d ata m emory description the c ontents o f t he a ccumulator a re c opied to t he s pecifed d ata m emory. operation [m] a cc affected f ag(s) none nop no o peration description no o peration i s p erformed. e xecution c ontinues w ith t he n ext i nstruction. operation no operation affected f ag(s) none or a,[m] logical o r d ata m emory to a cc description data i n t he a ccumulator a nd t he s pecifed d ata m emory p erform a b itwise logical o r op eration. t he re sult is s tored in t he a ccumulator. operation acc a cc or [ m] affected f ag(s) z or a,x logical or im mediate data to a cc description data i n t he a ccumulator a nd t he s pecifed im mediate data p erform a b itwise l ogical o r operation. t he re sult is s tored in t he a ccumulator. operation acc a cc or x affected f ag(s) z orm a,[m] logical or a cc to d ata m emory description data i n t he s pecifed d ata m emory a nd t he a ccumulator p erform a b itwise l ogical o r operation. t he re sult is s tored in t he d ata m emory. operation [m] a cc or [ m] affected f ag(s) z ret return from s ubroutine description the p rogram c ounter is re stored f rom t he s tack. p rogram e xecution c ontinues a t t he re stored a ddress. operation program counter s tack affected f ag(s) none
rev. 1.00 106 ?a? 0?? ?01? rev. 1.00 107 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu ret a,x return f rom su broutine and l oad im mediate data to a cc description the p rogram c ounter i s r estored f rom t he s tack a nd t he a ccumulator l oaded w ith t he s pecifed immediate data. p rogram e xecution c ontinues a t t he r estored a ddress. operation program counter s tack acc x affected f ag(s) none reti return from i nterrupt description the p rogram c ounter is re stored f rom t he s tack a nd t he interrupts a re re -enabled b y s etting t he emi b it. e mi i s t he m aster i nterrupt g lobal e nable b it. i f a n i nterrupt w as p ending w hen t he reti instruction is e xecuted, t he p ending in terrupt ro utine w ill b e p rocessed b efore re turning to t he m ain p rogram. operation program counter s tack emi 1 affected f ag(s) none rl [m] rotate d ata m emory l eft description the c ontents o f t he s pecifed d ata m emory a re r otated l eft b y 1 b it w ith b it 7 r otated i nto b it 0 . operation [m].(i+1) [ m].i; (i=0~6) [m].0 [ m].7 affected f ag(s) none rla [m] rotate d ata m emory left w ith re sult in a cc description the c ontents o f t he s pecifed d ata m emory a re r otated l eft b y 1 b it w ith b it 7 r otated i nto b it 0 . the r otated r esult i s s tored i n t he a ccumulator a nd t he c ontents o f t he d ata m emory r emain u nchanged. operation acc.(i+1) [ m].i; (i=0~6) acc.0 [ m].7 affected f ag(s) none rlc [m] rotate d ata m emory l eft t hrough carry description the c ontents o f t he s pecifed d ata m emory a nd t he c arry f ag a re r otated l eft b y 1 b it. b it 7 replaces t he c arry b it a nd t he o riginal c arry f ag i s r otated i nto b it 0 . operation [m].(i+1) [ m].i; (i=0~6) [m].0 c c [ m].7 affected f ag(s) c rlca [m] rotate d ata m emory left t hrough c arry w ith re sult in a cc description data i n t he s pecifed d ata m emory and t he carry f ag are r otated l eft b y 1 b it. b it 7 r eplaces t he carry b it a nd t he o riginal c arry f ag i s r otated i nto t he b it 0 . th e r otated r esult i s s tored i n t he accumulator a nd t he c ontents o f t he d ata m emory r emain u nchanged. operation acc.(i+1) [ m].i; (i=0~6) acc.0 c c [ m].7 affected f ag(s) c rr [m] rotate d ata m emory r ight description the contents of t he s pecifed d ata m emory are r otated r ight b y 1 b it w ith b it 0 r otated i nto b it 7 . operation [m].i [ m].(i+1); (i=0~6) [m].7 [ m].0 affected f ag(s) none
rev. 1.00 108 ? a ? 0 ?? ? 01 ? rev. 1.00 109 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu rra [m] rotate d ata m emory right with result i n a cc description data i n t he s pecifed d ata m emory a nd t he c arry f ag a re r otated r ight b y 1 b it w ith b it 0 rotated i nto b it 7 . th e r otated r esult i s s tored i n t he a ccumulator a nd t he c ontents o f t he data m emory r emain u nchanged. operation acc.i [ m].(i+1); (i=0~6) acc.7 [ m].0 affected f ag(s) none rrc [m] rotate d ata m emory r ight t hrough carry description the c ontents o f t he s pecifed d ata m emory a nd t he c arry f ag a re r otated r ight b y 1 b it. b it 0 replaces t he c arry b it a nd t he o riginal c arry f ag i s r otated i nto b it 7 . operation [m].i [ m].(i+1); (i=0~6) [m].7 c c [ m].0 affected f ag(s) c rrca [m] rotate d ata m emory right th rough c arry with result i n a cc description data i n t he s pecifed d ata m emory a nd t he c arry f ag a re r otated r ight b y 1 b it. b it 0 r eplaces the c arry b it a nd t he o riginal c arry f ag i s r otated i nto b it 7 . th e r otated r esult i s s tored i n t he accumulator a nd t he c ontents o f t he d ata m emory r emain u nchanged. operation acc.i [ m].(i+1); (i=0~6) acc.7 c c [ m].0 affected f ag(s) c sbc a,[m] subtract d ata m emory from a cc wi th c arry description the c ontents o f t he s pecifed d ata m emory a nd t he c omplement o f t he c arry f ag a re subtracted f rom t he a ccumulator. t he re sult is s tored in t he a ccumulator. n ote t hat if t he result o f s ubtraction is n egative, t he c f ag w ill b e c leared t o 0 , o therwise if t he re sult is positive o r z ero, t he c f ag w ill b e s et to 1 . operation acc a cc ? [ m] ? c affected f ag(s) ov, z , a c, c sbcm a,[m] subtract d ata m emory from a cc wi th c arry a nd r esult i n d ata m emory description the c ontents o f t he s pecifed d ata m emory a nd t he c omplement o f t he c arry f ag a re subtracted f rom t he a ccumulator. t he re sult is s tored in t he d ata m emory. n ote t hat if t he result o f s ubtraction is n egative, t he c f ag w ill b e c leared t o 0 , o therwise if t he re sult is positive o r z ero, t he c f ag w ill b e s et to 1 . operation [m] a cc ? [ m] ? c affected f ag(s) ov, z , a c, c sdz [m] skip i f decrement d ata m emory i s 0 description the c ontents o f t he s pecifed d ata m emory a re fr st decremented b y 1 . i f t he r esult i s 0 t he following instruction is s kipped. a s t his re quires t he insertion o f a d ummy instruction w hile the n ext instruction is f etched, it is a t wo c ycle instruction. i f t he re sult is n ot 0 t he p rogram proceeds w ith t he f ollowing i nstruction. operation [m] [ m] ? 1 skip if [ m]=0 affected f ag(s) none
rev. 1.00 108 ?a? 0?? ?01? rev. 1.00 109 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu sdza [m] skip i f decrement d ata m emory i s z ero w ith r esult i n a cc description the c ontents o f t he s pecifed d ata m emory a re fr st decremented b y 1 . i f t he r esult i s 0 , t he following instruction is s kipped. t he re sult is s tored in t he a ccumulator b ut t he sp ecifed data m emory c ontents r emain u nchanged. a s t his r equires t he i nsertion o f a dummy instruction w hile t he n ext instruction is f etched, it is a t wo c ycle instruction. i f t he r esult is n ot 0 , the p rogram p roceeds w ith t he f ollowing instruction. operation acc [ m] ? 1 skip if a cc=0 affected f ag(s) none set [m] set d ata m emory description each b it o f t he s pecifed d ata m emory i s s et t o 1 . operation [m] f fh affected f ag(s) none set [m].i set b it o f d ata m emory description bit i o f t he s pecifed d ata m emory i s s et t o 1 . operation [m].i 1 affected f ag(s) none siz [m] skip i f i ncrement d ata m emory i s 0 description the c ontents o f t he sp ecifed d ata m emory a re f rst incremented b y 1 . i f t he re sult is 0 , t he following instruction is s kipped. a s t his re quires t he insertion o f a d ummy instruction w hile the n ext instruction is f etched, it is a t wo c ycle instruction. i f t he re sult is n ot 0 t he p rogram proceeds w ith t he f ollowing i nstruction. operation [m] [ m] + 1 skip if [ m]=0 affected f ag(s) none siza [m] skip if increment d ata m emory is z ero w ith re sult in a cc description the c ontents o f t he sp ecifed d ata m emory a re f rst incremented b y 1 . i f t he re sult is 0 , t he following instruction is s kipped. t he re sult is s tored in t he a ccumulator b ut t he sp ecifed data m emory c ontents r emain u nchanged. a s t his r equires t he i nsertion o f a dummy instruction w hile t he n ext instruction is f etched, it is a t wo c ycle instruction. i f t he re sult is n ot 0 t he p rogram p roceeds w ith t he f ollowing instruction. operation acc [ m] + 1 skip if a cc=0 affected f ag(s) none snz [m].i skip i f b it i of d ata m emory i s n ot 0 description if b it i o f t he sp ecifed d ata m emory is n ot 0 , t he f ollowing instruction is s kipped. a s t his requires t he insertion o f a d ummy instruction w hile t he n ext instruction is f etched, it is a t wo cycle instruction. i f t he re sult is 0 t he p rogram p roceeds w ith t he f ollowing instruction. operation skip i f [ m].i 0 affected f ag(s) none sub a,[m] subtract d ata m emory from a cc description the s pecifed d ata m emory i s s ubtracted f rom t he c ontents o f t he a ccumulator. th e r esult i s stored in t he a ccumulator. n ote t hat if t he re sult o f s ubtraction is n egative, t he c f ag w ill b e cleared to 0 , o therwise i f t he r esult i s p ositive o r z ero, t he c f ag w ill b e s et to 1 . operation acc a cc ? [ m] affected f ag(s) ov, z , a c, c
rev. 1.00 110 ? a ? 0 ?? ? 01 ? rev. 1.00 111 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu subm a,[m] subtract d ata m emory from a cc wi th r esult i n d ata m emory description the s pecifed d ata m emory i s s ubtracted f rom t he c ontents o f t he a ccumulator. th e r esult i s stored in t he d ata m emory. n ote t hat if t he re sult o f s ubtraction is n egative, t he c f ag w ill b e cleared to 0 , o therwise i f t he r esult i s p ositive o r z ero, t he c f ag w ill b e s et to 1 . operation [m] a cc ? [ m] affected f ag(s) ov, z , a c, c sub a,x subtract im mediate data f rom a cc description the im mediate data s pecifed b y t he c ode i s s ubtracted f rom t he c ontents o f t he a ccumulator. the re sult is s tored in t he a ccumulator. n ote t hat if t he re sult o f s ubtraction is n egative, t he c fag w ill b e c leared to 0 , o therwise i f t he r esult i s p ositive o r z ero, t he c f ag w ill b e s et to 1 . operation acc a cc ? x affected f ag(s) ov, z , a c, c swap [m] swap ni bbles of d ata m emory description the l ow-order a nd h igh-order n ibbles o f t he s pecifed d ata m emory a re i nterchanged. operation [m].3~[m].0 ? [ m].7~[m].4 affected f ag(s) none swapa [m] swap ni bbles of d ata m emory w ith r esult i n a cc description the l ow-order a nd h igh-order n ibbles o f t he s pecifed d ata m emory a re i nterchanged. th e result i s s tored i n t he a ccumulator. th e c ontents o f t he d ata m emory r emain u nchanged. operation acc.3~acc.0 [ m].7~[m].4 acc.7~acc.4 [ m].3~[m].0 affected f ag(s) none sz [m] skip i f d ata m emory i s 0 description if t he contents of t he s pecifed d ata m emory i s 0, t he following i nstruction i s s kipped. a s t his requires t he insertion o f a d ummy instruction w hile t he n ext instruction is f etched, it is a t wo cycle instruction. i f t he re sult is n ot 0 t he p rogram p roceeds w ith t he f ollowing instruction. operation skip if [ m]=0 affected f ag(s) none sza [m] skip i f d ata m emory i s 0 w ith data m ovement to a cc description the c ontents o f t he s pecifed d ata m emory a re c opied to t he a ccumulator. i f t he v alue i s z ero, the f ollowing instruction is s kipped. a s t his re quires t he insertion o f a d ummy instruction while t he n ext instruction is f etched, it is a t wo c ycle instruction. i f t he re sult is n ot 0 t he program p roceeds w ith t he f ollowing instruction. operation acc [ m] skip if [ m]=0 affected f ag(s) none sz [m].i skip i f b it i of d ata m emory i s 0 description if b it i o f t he sp ecifed d ata m emory is 0 , t he f ollowing instruction is s kipped. a s t his re quires the insertion o f a d ummy instruction w hile t he n ext instruction is f etched, it is a t wo c ycle instruction. i f t he re sult is n ot 0 , t he p rogram p roceeds w ith t he f ollowing instruction. operation skip if [ m].i=0 affected f ag(s) none
rev. 1.00 110 ?a? 0?? ?01? rev. 1.00 111 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu tabrdc [m] read ta ble ( current p age) to t blh a nd d ata m emory description the low b yte o f t he p rogram c ode a ddressed b y t he t able p ointer ( tblp/tbhp) is moved t o t he s pecifed d ata m emory a nd t he h igh by te mo ved t o t blh. operation [m] pr ogram c ode (low by te) tblh pr ogram c ode (high by te) affected f ag(s) none tabrdl [m] read t able (last p age) t o t blh a nd d ata m emory description the l ow by te o f t he pr ogram c ode (last p age) a ddressed by t he t able p ointer (tblp) i s mo ved to t he s pecifed d ata m emory a nd t he h igh b yte m oved to t blh. operation [m] pr ogram c ode (low by te) tblh pr ogram c ode (high by te) affected f ag(s) none xor a,[m] logical x or d ata m emory to a cc description data i n t he a ccumulator a nd t he s pecifed d ata m emory p erform a b itwise l ogical x or operation. t he re sult is s tored in t he a ccumulator. operation acc a cc x or [ m] affected f ag(s) z xorm a,[m] logical x or a cc to d ata m emory description data i n t he s pecifed d ata m emory a nd t he a ccumulator p erform a b itwise l ogical x or operation. t he re sult is s tored in t he d ata m emory. operation [m] a cc xor [ m] affected f ag(s) z xor a,x logical x or im mediate data to a cc description data i n t he a ccumulator a nd t he s pecifed im mediate data p erform a b itwise l ogical x or operation. t he re sult is s tored in t he a ccumulator. operation acc a cc x or x affected f ag(s) z
rev. 1.00 11 ? ? a ? 0 ?? ? 01 ? rev. 1.00 11 ? ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu package information note that the package information provided here is for consultation purposes only . as this information may be updated at regular intervals users are reminded to consult the holtek website for the latest version of the package information. additional supplementary information with regard to pa ckaging is listed below. click on the relevant section to be transferred to the relevant website page. ? further package information (include outline dimensions, product t ape and reel specifcations) ? packing meterials information ? carton information ? pb free products ? green packages products
rev. 1.00 11 ? ?a? 0?? ?01? rev. 1.00 11 ? ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu 16-pin nsop (150mil) outline dimensions ms-012 symbol dimensions in inch min. nom. max. a 0. ?? 8 0. ? 44 b 0.150 0.157 c 0.01 ? 0.0 ? 0 c 0. ? 86 0.40 ? d 0.069 e 0.050 f 0.004 0.010 g 0.016 0.050 h 0.007 0.010 0 8 symbol dimensions in mm min. nom. max. a 5.79 6. ? 0 b ? .81 ? .99 c 0. ? 0 0.51 c 9.80 10. ? 1 d 1.75 e 1. ? 7 f 0.10 0. ? 5 g 0.41 1. ? 7 h 0.18 0. ? 5 0 8
rev. 1.00 114 ? a ? 0 ?? ? 01 ? rev. 1.00 115 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu 16-pin ssop(150mil) outline dimensions symbol dimensions in inch min. nom. min. a 0. ?? 8 0. ? 44 b 0.150 0.157 c 0.008 0.01 ? c 0.189 0.197 d 0.054 0.060 e 0.0 ? 5 f 0.004 0.010 g 0.0 ?? 0.0 ? 8 h 0.007 0.010 0 8 symbol dimensions in mm min. nom. min. a 5.79 6. ? 0 b ? .81 ? .99 c 0. ? 0 0. ? 0 c 4.80 5.00 d 1. ? 7 1.5 ? e 0.64 f 0.10 0. ? 5 g 0.56 0.71 h 0.18 0. ? 5 0 8
rev. 1.00 114 ?a? 0?? ?01? rev. 1.00 115 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu 20-pin sop (300mil) outline dimensions ms-013 symbol dimensions in inch min. nom. max. a 0. ? 9 ? 0.419 b 0. ? 56 0. ? 00 c 0.01 ? 0.0 ? 0 c 0.496 0.51 ? d 0.104 e 0.050 f 0.004 0.01 ? g 0.016 0.050 h 0.008 0.01 ? 0 8 symbol dimensions in mm min. nom. max. a 9.98 10.64 b 6.50 7.6 ? c 0. ? 0 0.51 c 1 ? .60 1 ? .00 d ? .64 e 1. ? 7 f 0.10 0. ? 0 g 0.41 1. ? 7 h 0. ? 0 0. ?? 0 8
rev. 1.00 116 ? a ? 0 ?? ? 01 ? rev. 1.00 117 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu 20-pin ssop (150mil) outline dimensions symbol dimensions in inch min. nom. max. a 0. ?? 8 0. ? 44 b 0.150 0.158 c 0.008 0.01 ? c 0. ?? 5 0. ? 47 d 0.049 0.065 e 0.0 ? 5 f 0.004 0.010 g 0.015 0.050 h 0.007 0.010 0 8 symbol dimensions in mm min. nom. max. a 5.79 6. ? 0 b ? .81 4.01 c 0. ? 0 0. ? 0 c 8.51 8.81 d 1. ? 4 1.65 e 0.64 f 0.10 0. ? 5 g 0. ? 8 1. ? 7 h 0.18 0. ? 5 0 8
rev. 1.00 116 ?a? 0?? ?01? rev. 1.00 117 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu 24-pin sop (300mil) outline dimensions ms-013 symbol dimensions in inch min. nom. min. a 0. ? 9 ? 0.419 b 0. ? 56 0. ? 00 c 0.01 ? 0.0 ? 0 c 0.598 0.61 ? d 0.104 e 0.050 f 0.004 0.01 ? g 0.016 0.050 h 0.008 0.01 ? 0 8 symbol dimensions in mm min. nom. min. a 9.98 10.64 b 6.50 7.6 ? c 0. ? 0 0.51 c 15.19 15.57 d ? .64 e 1. ? 7 f 0.10 0. ? 0 g 0.41 1. ? 7 h 0. ? 0 0. ?? 0 8
rev. 1.00 118 ? a ? 0 ?? ? 01 ? rev. 1.00 119 ?a? 0?? ?01? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu 24-pin ssop (150mil) outline dimensions symbol dimensions in inch min. nom. min. a 0. ?? 8 0. ? 44 b 0.150 0.157 c 0.008 0.01 ? c 0. ?? 5 0. ? 46 d 0.054 0.060 e 0.0 ? 5 f 0.004 0.010 g 0.0 ?? 0.0 ? 8 h 0.007 0.010 0 8 symbol dimensions in mm min. nom. min. a 5.79 6. ? 0 b ? .81 ? .99 c 0. ? 0 0. ? 0 c 8.51 8.79 d 1. ? 7 1.5 ? e 0.64 f 0.10 0. ? 5 g 0.56 0.71 h 0.18 0. ? 5 0 8
rev. 1.00 118 ?a? 0?? ?01? rev. 1.00 119 ? a ? 0 ?? ? 01 ? bs83b08a-3/bs83b12a-3/bs83b16a-3 bs83b08a-4/bs83b12a-4/BS83B16A-4 8-bit touch key flash mcu cop ? right ? ? 01 ? b ? holtek se ? iconductor inc. the information appearing in this data sheet is believed to be accurate at the time of publication. however ? holtek assumes no responsibilit ? arising from the use of the specifcations described. the applications mentioned herein are used solely for the purpose of illustration and holtek makes no warrant ? or representation that such applications will be suitable without further modification ? nor recommends the use of its products for application that ma ? present a risk to human life due to malfunction or otherwise. holtek's products are not authorized for use as critical components in life support devices or s ? stems. holtek reserves the right to alter its products without prior notifcation. for the most up-to-date information, please visit our web site at http://www.holtek.com.


▲Up To Search▲   

 
Price & Availability of BS83B16A-4

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X